Code example for ReadableByteChannel

Methods: close

0
    public boolean isEndOfInput() throws Exception { 
        return !hasNextChunk(); 
    } 
 
    public void close() throws Exception { 
        in.close();
    } 
 
    public Object nextChunk() throws Exception {
        if (!hasNextChunk()) { 
            return null; 
        } 
        // buffer cannot be not be empty from there 
        int readBytes = byteBuffer.position();
        for (;;) { 
            int localReadBytes = in.read(byteBuffer);
            if (localReadBytes < 0) {
                break; 
            } 
            readBytes += localReadBytes;
            offset += localReadBytes;