@Test public void testMark() throws Exception { final LimitedInputStream lis = new LimitedInputStream(bais, 6); assertEquals(3, lis.read(buffer3)); assertEquals(3, lis.read(buffer10)); lis.reset(); assertEquals(3, lis.read(buffer3)); lis.mark(1000); assertEquals(3, lis.read(buffer10)); lis.reset(); assertEquals(3, lis.read(buffer10)); }
@Override public void mark(int readlimit) { in.mark(readlimit); limit -= bytesRead; bytesRead = 0; }
LimitedInputStream extends InputStream { @Override public void mark(int readlimit) { in.mark(readlimit); limit -= bytesRead; bytesRead = 0; } }
LimitedInputStream extends InputStream { @Override public void mark(int readlimit) { in.mark(readlimit); limit -= bytesRead; bytesRead = 0; } LimitedInputStream(final InputStream in, final long limit); }
LimitedInputStream extends InputStream { @Override public void mark(int readlimit) { in.mark(readlimit); limit -= bytesRead; bytesRead = 0; } LimitedInputStream(final InputStream in, final long limit); @Override int read(); @Override int read(final byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(final long n); @Override int available(); @Override void close(); @Override void mark(int readlimit); @Override boolean markSupported(); @Override void reset(); }
LimitedInputStream extends InputStream { @Override public void mark(int readlimit) { in.mark(readlimit); limit -= bytesRead; bytesRead = 0; } LimitedInputStream(final InputStream in, final long limit); @Override int read(); @Override int read(final byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(final long n); @Override int available(); @Override void close(); @Override void mark(int readlimit); @Override boolean markSupported(); @Override void reset();  }