@Test public void testPeekFullyAcrossEndOfInputWithAllowEndOfInputFails() throws Exception { DefaultExtractorInput input = createDefaultExtractorInput(); byte[] target = new byte[TEST_DATA.length]; assertThat(input.peekFully(target, 0, TEST_DATA.length - 1, true)).isTrue(); try { input.peekFully(target, 0, 2, true); fail(); } catch (EOFException e) { } }
@Override public boolean peekFully(byte[] target, int offset, int length, boolean allowEndOfInput) throws IOException, InterruptedException { if (!advancePeekPosition(length, allowEndOfInput)) { return false; } System.arraycopy(peekBuffer, peekBufferPosition - length, target, offset, length); return true; }
DefaultExtractorInput implements ExtractorInput { @Override public boolean peekFully(byte[] target, int offset, int length, boolean allowEndOfInput) throws IOException, InterruptedException { if (!advancePeekPosition(length, allowEndOfInput)) { return false; } System.arraycopy(peekBuffer, peekBufferPosition - length, target, offset, length); return true; } }
DefaultExtractorInput implements ExtractorInput { @Override public boolean peekFully(byte[] target, int offset, int length, boolean allowEndOfInput) throws IOException, InterruptedException { if (!advancePeekPosition(length, allowEndOfInput)) { return false; } System.arraycopy(peekBuffer, peekBufferPosition - length, target, offset, length); return true; } DefaultExtractorInput(DataSource dataSource, long position, long length); }
DefaultExtractorInput implements ExtractorInput { @Override public boolean peekFully(byte[] target, int offset, int length, boolean allowEndOfInput) throws IOException, InterruptedException { if (!advancePeekPosition(length, allowEndOfInput)) { return false; } System.arraycopy(peekBuffer, peekBufferPosition - length, target, offset, length); return true; } 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 boolean peekFully(byte[] target, int offset, int length, boolean allowEndOfInput) throws IOException, InterruptedException { if (!advancePeekPosition(length, allowEndOfInput)) { return false; } System.arraycopy(peekBuffer, peekBufferPosition - length, target, offset, length); return true; } 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);  }