class LimitedInputStream extends InputStream {

    @Override
    public int available() throws IOException {
        return (int)(limit - bytesRead);
    }

    public  LimitedInputStream(final InputStream in, final long limit);

}