Class BufferingByteChannel

java.lang.Object
org.bluezoo.util.BufferingByteChannel
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, Channel, WritableByteChannel

public class BufferingByteChannel extends Object implements WritableByteChannel, Flushable
A WritableByteChannel decorator that buffers writes into a fixed-size ByteBuffer before flushing to the underlying channel.

This reduces the number of blocking I/O syscalls when writing to file-backed channels by accumulating small writes and flushing them as larger chunks. The buffer is flushed automatically when full, or explicitly via flush().

This is a pure NIO implementation with no InputStream or OutputStream involvement.

Author:
Chris Burdess