public static ByteBufferWriter of(WritableByteChannel channel, Closeable close) throws IOException {
        return new ByteBufferWriter() {
            @Override
            public void write(ByteBuffer src) throws IOException {
                IOUtil.writeFully(channel, src);
            }

            @Override
            public void close() throws IOException {
                if (close != null) {
                    close.close();
                }
            }
        };
    }
Open a writer with known incomming data size.
indexr-common/src/main/java/io/indexr/io/ByteBufferWriter.java