@Override public long write( String path, ReadableByteChannel data, ByteBuffer temporaryBuffer, boolean hasData, int requiredElementAlignment ) throws IOException { char[] chars = path.toCharArray(); targetBuffer.writeShort( chars.length ); Protocol.writeChars( targetBuffer, chars ); targetBuffer.writeByte( hasData ? 1 : 0 ); // TODO Make use of temporaryBuffer? BlockLogBuffer buffer = new BlockLogBuffer( targetBuffer, bufferMonitor ); long totalWritten = Short.BYTES + chars.length * Character.BYTES + Byte.BYTES; if ( hasData ) { targetBuffer.writeInt( requiredElementAlignment ); totalWritten += Integer.BYTES; totalWritten += buffer.write( data ); buffer.close(); } return totalWritten; }