DefaultOggSeeker implements OggSeeker { @VisibleForTesting void skipToNextPage(ExtractorInput input) throws IOException, InterruptedException { if (!skipToNextPage(input, payloadEndPosition)) { throw new EOFException(); } } DefaultOggSeeker(
      StreamReader streamReader,
      long payloadStartPosition,
      long payloadEndPosition,
      long firstPayloadPageSize,
      long firstPayloadPageGranulePosition,
      boolean firstPayloadPageIsLastPage); @Override long read(ExtractorInput input); @Override OggSeekMap createSeekMap(); @Override void startSeek(long targetGranule);  }
@Test public void testSkipToNextPage() throws Exception { FakeExtractorInput extractorInput = OggTestData.createInput( TestUtil.joinByteArrays( TestUtil.buildTestData(4000, random), new byte[] {'O', 'g', 'g', 'S'}, TestUtil.buildTestData(4000, random)), false); skipToNextPage(extractorInput); assertThat(extractorInput.getPosition()).isEqualTo(4000); }
@Test public void testSkipToNextPageOverlap() throws Exception { FakeExtractorInput extractorInput = OggTestData.createInput( TestUtil.joinByteArrays( TestUtil.buildTestData(2046, random), new byte[] {'O', 'g', 'g', 'S'}, TestUtil.buildTestData(4000, random)), false); skipToNextPage(extractorInput); assertThat(extractorInput.getPosition()).isEqualTo(2046); }
@Test public void testSkipToNextPageInputShorterThanPeekLength() throws Exception { FakeExtractorInput extractorInput = OggTestData.createInput( TestUtil.joinByteArrays(new byte[] {'x', 'O', 'g', 'g', 'S'}), false); skipToNextPage(extractorInput); assertThat(extractorInput.getPosition()).isEqualTo(1); }
@Test public void testSkipToNextPageNoMatch() throws Exception { FakeExtractorInput extractorInput = OggTestData.createInput(new byte[] {'g', 'g', 'S', 'O', 'g', 'g'}, false); try { skipToNextPage(extractorInput); fail(); } catch (EOFException e) { } }