@Test public void testLargeSkip() throws Exception { FakeDataSource testDataSource = buildLargeDataSource(); DefaultExtractorInput input = new DefaultExtractorInput(testDataSource, 0, C.LENGTH_UNSET); int bytesToSkip = LARGE_TEST_DATA_LENGTH; while (bytesToSkip > 0) { bytesToSkip -= input.skip(bytesToSkip); } }
@Override public int skip(int length) throws IOException, InterruptedException { int bytesSkipped = skipFromPeekBuffer(length); if (bytesSkipped == 0) { bytesSkipped = readFromDataSource(scratchSpace, 0, Math.min(length, scratchSpace.length), 0, true); } commitBytesRead(bytesSkipped); return bytesSkipped; }
DefaultExtractorInput implements ExtractorInput { @Override public int skip(int length) throws IOException, InterruptedException { int bytesSkipped = skipFromPeekBuffer(length); if (bytesSkipped == 0) { bytesSkipped = readFromDataSource(scratchSpace, 0, Math.min(length, scratchSpace.length), 0, true); } commitBytesRead(bytesSkipped); return bytesSkipped; } }
DefaultExtractorInput implements ExtractorInput { @Override public int skip(int length) throws IOException, InterruptedException { int bytesSkipped = skipFromPeekBuffer(length); if (bytesSkipped == 0) { bytesSkipped = readFromDataSource(scratchSpace, 0, Math.min(length, scratchSpace.length), 0, true); } commitBytesRead(bytesSkipped); return bytesSkipped; } DefaultExtractorInput(DataSource dataSource, long position, long length); }
DefaultExtractorInput implements ExtractorInput { @Override public int skip(int length) throws IOException, InterruptedException { int bytesSkipped = skipFromPeekBuffer(length); if (bytesSkipped == 0) { bytesSkipped = readFromDataSource(scratchSpace, 0, Math.min(length, scratchSpace.length), 0, true); } commitBytesRead(bytesSkipped); return bytesSkipped; } DefaultExtractorInput(DataSource dataSource, long position, long length); @Override int read(byte[] target, int offset, int length); @Override boolean readFully(byte[] target, int offset, int length, boolean allowEndOfInput); @Override void readFully(byte[] target, int offset, int length); @Override int skip(int length); @Override boolean skipFully(int length, boolean allowEndOfInput); @Override void skipFully(int length); @Override boolean peekFully(byte[] target, int offset, int length, boolean allowEndOfInput); @Override void peekFully(byte[] target, int offset, int length); @Override boolean advancePeekPosition(int length, boolean allowEndOfInput); @Override void advancePeekPosition(int length); @Override void resetPeekPosition(); @Override long getPeekPosition(); @Override long getPosition(); @Override long getLength(); @Override void setRetryPosition(long position, E e); }
DefaultExtractorInput implements ExtractorInput { @Override public int skip(int length) throws IOException, InterruptedException { int bytesSkipped = skipFromPeekBuffer(length); if (bytesSkipped == 0) { bytesSkipped = readFromDataSource(scratchSpace, 0, Math.min(length, scratchSpace.length), 0, true); } commitBytesRead(bytesSkipped); return bytesSkipped; } DefaultExtractorInput(DataSource dataSource, long position, long length); @Override int read(byte[] target, int offset, int length); @Override boolean readFully(byte[] target, int offset, int length, boolean allowEndOfInput); @Override void readFully(byte[] target, int offset, int length); @Override int skip(int length); @Override boolean skipFully(int length, boolean allowEndOfInput); @Override void skipFully(int length); @Override boolean peekFully(byte[] target, int offset, int length, boolean allowEndOfInput); @Override void peekFully(byte[] target, int offset, int length); @Override boolean advancePeekPosition(int length, boolean allowEndOfInput); @Override void advancePeekPosition(int length); @Override void resetPeekPosition(); @Override long getPeekPosition(); @Override long getPosition(); @Override long getLength(); @Override void setRetryPosition(long position, E e);  }