FlacMetadataReader { @Nullable public static Metadata readId3Metadata(ExtractorInput input, boolean parseData) throws IOException, InterruptedException { input.resetPeekPosition(); long startingPeekPosition = input.getPeekPosition(); @Nullable Metadata id3Metadata = peekId3Metadata(input, parseData); int peekedId3Bytes = (int) (input.getPeekPosition() - startingPeekPosition); input.skipFully(peekedId3Bytes); return id3Metadata; } private  FlacMetadataReader(); @Nullable static Metadata peekId3Metadata(ExtractorInput input, boolean parseData); static boolean checkAndPeekStreamMarker(ExtractorInput input); @Nullable static Metadata readId3Metadata(ExtractorInput input, boolean parseData); static void readStreamMarker(ExtractorInput input); static boolean readMetadataBlock(
      ExtractorInput input, FlacStreamMetadataHolder metadataHolder); static FlacStreamMetadata.SeekTable readSeekTableMetadataBlock(ParsableByteArray data); static int getFrameStartMarker(ExtractorInput input);  }
@Test public void readId3Metadata_parseData_returnsNonEmptyMetadata() throws Exception { ExtractorInput input = buildExtractorInput("flac/bear_with_id3_enabled.flac"); Metadata metadata = FlacMetadataReader.readId3Metadata(input, true); assertThat(metadata).isNotNull(); assertThat(metadata.length()).isNotEqualTo(0); }
@Test public void readId3Metadata_doNotParseData_returnsNull() throws Exception { ExtractorInput input = buildExtractorInput("flac/bear_with_id3_enabled.flac"); Metadata metadata = FlacMetadataReader.readId3Metadata(input, false); assertThat(metadata).isNull(); }
@Test public void readId3Metadata_noId3Metadata_returnsNull() throws Exception { ExtractorInput input = buildExtractorInput("flac/bear.flac"); Metadata metadata = FlacMetadataReader.readId3Metadata(input, true); assertThat(metadata).isNull(); }