@Test public void testAvailable() throws Exception { final LimitedInputStream lis = new LimitedInputStream(bais, 4); assertNotEquals(data.length, lis.available()); lis.reset(); assertEquals(4, lis.available()); assertEquals(1, lis.read(buffer3, 0, 1)); assertEquals(3, lis.available()); }
@Override public int available() throws IOException { return (int)(limit - bytesRead); }
LimitedInputStream extends InputStream { @Override public int available() throws IOException { return (int)(limit - bytesRead); } }
LimitedInputStream extends InputStream { @Override public int available() throws IOException { return (int)(limit - bytesRead); } LimitedInputStream(final InputStream in, final long limit); }
LimitedInputStream extends InputStream { @Override public int available() throws IOException { return (int)(limit - bytesRead); } 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 int available() throws IOException { return (int)(limit - bytesRead); } 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();  }