DefaultExtractorInput implements ExtractorInput { @Override public int read(byte[] target, int offset, int length) throws IOException, InterruptedException { int bytesRead = readFromPeekBuffer(target, offset, length); if (bytesRead == 0) { bytesRead = readFromDataSource( target, offset, length, 0, true); } commitBytesRead(bytesRead); return bytesRead; } 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 int peek(byte[] target, int offset, 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);  }
@Test public void testReadZeroLength() throws Exception { DefaultExtractorInput input = createDefaultExtractorInput(); byte[] target = new byte[TEST_DATA.length]; int bytesRead = input.read(target, 0, 0); assertThat(bytesRead).isEqualTo(0); }