@Test public void testSkipIncludedFailure() throws IOException { byte[] bytes = new byte[100]; InputStream is = new LengthCheckInputStream( new ByteArrayInputStream(bytes), 90, INCLUDE_SKIPPED_BYTES); assertTrue(10 == is.skip(10)); try { StreamUtils.consumeInputStream(is); fail(); } catch(AmazonClientException ex) { } is.close(); }
@Override public long skip(long n) throws IOException { final long skipped = super.skip(n); if (includeSkipped && skipped > 0) { dataLength += skipped; checkLength(false); } return skipped; }
LengthCheckInputStream extends SdkFilterInputStream { @Override public long skip(long n) throws IOException { final long skipped = super.skip(n); if (includeSkipped && skipped > 0) { dataLength += skipped; checkLength(false); } return skipped; } }
LengthCheckInputStream extends SdkFilterInputStream { @Override public long skip(long n) throws IOException { final long skipped = super.skip(n); if (includeSkipped && skipped > 0) { dataLength += skipped; checkLength(false); } return skipped; } LengthCheckInputStream(InputStream in, long expectedLength,
            boolean includeSkipped); }
LengthCheckInputStream extends SdkFilterInputStream { @Override public long skip(long n) throws IOException { final long skipped = super.skip(n); if (includeSkipped && skipped > 0) { dataLength += skipped; checkLength(false); } return skipped; } LengthCheckInputStream(InputStream in, long expectedLength,
            boolean includeSkipped); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void mark(int readlimit); @Override void reset(); @Override long skip(long n); }
LengthCheckInputStream extends SdkFilterInputStream { @Override public long skip(long n) throws IOException { final long skipped = super.skip(n); if (includeSkipped && skipped > 0) { dataLength += skipped; checkLength(false); } return skipped; } LengthCheckInputStream(InputStream in, long expectedLength,
            boolean includeSkipped); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void mark(int readlimit); @Override void reset(); @Override long skip(long n); static final boolean INCLUDE_SKIPPED_BYTES; static final boolean EXCLUDE_SKIPPED_BYTES; }