class FileChannelInputStream extends InputStream {

    private final FileChannel channel;
    private final boolean closeChannel;

    private ByteBuffer buffer;
    private long pos;

    /**
     * Create a new file object input stream from the file channel.
     *
     * @param channel the file channel
     * @param closeChannel whether closing the stream should close the channel
     */
    public FileChannelInputStream(FileChannel channel, boolean closeChannel) {
        this.channel = channel;
        this.closeChannel = closeChannel;
    }

    @Override
    public int read() throws IOException {<FILL_FUNCTION_BODY>}

    @Override
    public int read(byte[] b) throws IOException {
        return read(b, 0, b.length);
    }

    @Override
    public int read(byte[] b, int off, int len) throws IOException {
        ByteBuffer buff = ByteBuffer.wrap(b, off, len);
        int read = channel.read(buff, pos);
        if (read == -1) {
            return -1;
        }
        pos += read;
        return read;
    }

    @Override
    public void close() throws IOException {
        if (closeChannel) {
            channel.close();
        }
    }
}

        if (buffer == null) {
            buffer = ByteBuffer.allocate(1);
        }
        buffer.rewind();
        int len = channel.read(buffer, pos++);
        if (len < 0) {
            return -1;
        }
        return buffer.get(0) & 0xff;
    
<methods>public void <init>() ,public int available() throws java.io.IOException,public void close() throws java.io.IOException,public synchronized void mark(int) ,public boolean markSupported() ,public static java.io.InputStream nullInputStream() ,public abstract int read() throws java.io.IOException,public int read(byte[]) throws java.io.IOException,public int read(byte[], int, int) throws java.io.IOException,public byte[] readAllBytes() throws java.io.IOException,public byte[] readNBytes(int) throws java.io.IOException,public int readNBytes(byte[], int, int) throws java.io.IOException,public synchronized void reset() throws java.io.IOException,public long skip(long) throws java.io.IOException,public void skipNBytes(long) throws java.io.IOException,public long transferTo(java.io.OutputStream) throws java.io.IOException<variables>private static final int DEFAULT_BUFFER_SIZE,private static final int MAX_BUFFER_SIZE,private static final int MAX_SKIP_BUFFER_SIZE