/** Serializes into a ByteBuffer for a given protocol. */ public void serialize(ByteBuffer buffer, BinaryProtocol protocol) { protocol.putString(name, buffer); LogUtils.writeInt(buffer, id); }
/** Returns serialized for a given protocol. */ public int serializedSize(BinaryProtocol protocol) { return protocol.stringSize(name) + 4; }
/** Serializes from a ByteBuffer for a given protocol. */ public static NameIdPair deserialize(ByteBuffer buffer, BinaryProtocol protocol) { return new NameIdPair(protocol.getString(buffer), LogUtils.readInt(buffer)); }