Code example for DataOutputStream

Methods: writeBoolean, writeUTF

0
 
    public static class TruncateResponseSerializer implements ICompactSerializer<TruncateResponse> 
    { 
        public void serialize(TruncateResponse tr, DataOutputStream dos) throws IOException
        { 
            dos.writeUTF(tr.keyspace);
            dos.writeUTF(tr.columnFamily);
            dos.writeBoolean(tr.success);
        } 
 
        public TruncateResponse deserialize(DataInputStream dis) throws IOException
        { 
            String keyspace = dis.readUTF();
            String columnFamily = dis.readUTF();
            boolean success = dis.readBoolean();
            return new TruncateResponse(keyspace, columnFamily, success);
        } 
    } 
}