### Question:
ArchiveSerializer { public static ByteBuffer write(ConsumeLog consumeLog) { int size = consumeLogSize(consumeLog); ByteBuffer buffer = byteBufferPool.acquire( 4 + size, false); buffer.putInt(size); buffer.put(consumeLog.getBytesMessageId()); buffer.putInt(consumeLog.getBrokerId()); byte[] clientIpBytes16 = new byte[16]; byte[] clientIpBytes = consumeLog.getClientIp(); System.arraycopy(clientIpBytes, 0, clientIpBytes16, 0, Math.min(clientIpBytes.length, clientIpBytes16.length)); buffer.put(clientIpBytes16); buffer.putLong(consumeLog.getConsumeTime()); byte[] appBytes = consumeLog.getApp().getBytes(Charset.forName("utf-8")); buffer.putShort((short) appBytes.length); buffer.put(appBytes); buffer.flip(); return buffer; }  static void release(ByteBuffer byteBuffer); static ByteBuffer write(ConsumeLog consumeLog); static ConsumeLog read(ByteBuffer buffer);  }### Answer:
@Test public void write() { ConsumeLog consumeLog = new ConsumeLog(); consumeLog.setApp("app_test"); consumeLog.setBrokerId(1); consumeLog.setClientIp(new byte[16]); consumeLog.setBytesMessageId(new byte[16]); consumeLog.setConsumeTime(SystemClock.now()); System.out.println(ToStringBuilder.reflectionToString(consumeLog)); ByteBuffer write = ArchiveSerializer.write(consumeLog); System.out.println(write.limit()); }