class BoundedInputStream extends InputStream {

    @Override
    public int read() throws IOException {
        if (max >= 0 && pos >= max) {
            return EOF;
        }
        final int result = in.read();
        pos++;
        return result;
    }

    public  BoundedInputStream(final InputStream in, final long size);
    public  BoundedInputStream(final InputStream in);

}