code: public Metadata[] readMetadata(StreamInfo streamInfo) throws IOException {
          if (streamInfo.isLast()) return new Metadata[0];
          ArrayList<Metadata> metadataList = new ArrayList<Metadata>();
          Metadata metadata;
          do {
              metadata = readNextMetadata();
              metadataList.add(metadata);
          } while (!metadata.isLast());
          return (Metadata[])metadataList.toArray(new Metadata[0]);
      }
docs: Read an array of metadata blocks.
  @param streamInfo    The StreamInfo metadata block previously read
  @return  The array of metadata blocks
  @throws IOException  On read error