Пример #1
0
 public static void serialiseView(View view, ByteBuf buf) {
   buf.writeInt(view.id);
   buf.writeInt(view.members.size());
   for (Address addr : view.members) {
     AddressSerializer.INSTANCE.toBinary(addr, buf);
   }
 }
Пример #2
0
 public static byte[] serialiseAddress(Address addr) {
   ByteBuf buf = Unpooled.buffer();
   AddressSerializer.INSTANCE.toBinary(addr, buf);
   byte[] bytes = new byte[buf.readableBytes()];
   buf.readBytes(bytes);
   buf.release();
   return bytes;
 }