Code example for DataOutputStream

Methods: writeBoolean, writeUTF

0
 
    public static class WriteResponseSerializer implements ICompactSerializer<WriteResponse> 
    { 
        public void serialize(WriteResponse wm, DataOutputStream dos) throws IOException
        { 
            dos.writeUTF(wm.table());
            ByteBufferUtil.writeWithShortLength(wm.key(), dos);
            dos.writeBoolean(wm.isSuccess());
        } 
 
        public WriteResponse deserialize(DataInputStream dis) throws IOException
        { 
            String table = dis.readUTF();
            ByteBuffer key = ByteBufferUtil.readWithShortLength(dis);
            boolean status = dis.readBoolean();
            return new WriteResponse(table, key, status);
        } 
    } 
}