Code example for WritableByteChannel

Methods: write

0
        public long totalBytes() { 
            return buffer.limit() - initialPos;
        } 
 
        public long transferTo(WritableByteChannel ch) throws IOException {
            return ch.write(buffer);
        } 
 
        public long transferTo(DatagramChannel ch, SocketAddress raddr) throws IOException {
            return ch.send(buffer, raddr);
        } 
 
        public void release() { 
            final Preallocation parent = this.parent;
            if (-- parent.refCnt == 0) {
                parent.buffer.clear();
                if (parent != current) {
                    poolHead = new PreallocationRef(parent, poolHead);
                } 
            } 
        }