Code example for ClosedChannelException

0
        this(size, 0);
    } 
 
    public int write(final ByteBuffer src) throws IOException {
        if (this.closed) {
            throw new ClosedChannelException();
        } 
        return this.buf.write(src);
    } 
 
    public boolean isOpen() { 
        return !this.closed;
    } 
 
    public void close() throws IOException { 
        this.closed = true;
    } 
 
    public void flush() { 
        this.buf.resetCapacity();
    }