private void writeHeader() throws IOException { ByteBuffer buf = ByteBuffer.allocateDirect(BinaryHeader.HEADER_SIZE); BinaryHeader header = BinaryHeader.create(format, index, userMap.size(), itemMap.size()); header.render(buf); buf.flip(); BinaryUtils.writeBuffer(channel, buf, 0); }