Code example for DataOutput

Methods: writeBytewriteIntwriteLong

0
    public final static int EXPIRATION_MASK = 0x02;
 
    public void serialize(IColumn column, DataOutput dos)
    { 
        assert column.name().remaining() > 0;
        ByteBufferUtil.writeWithShortLength(column.name(), dos);
        try 
        { 
            if (column instanceof ExpiringColumn) {
              dos.writeByte(EXPIRATION_MASK);
              dos.writeInt(((ExpiringColumn) column).getTimeToLive());
              dos.writeInt(column.getLocalDeletionTime());
            } else { 
              dos.writeByte((column.isMarkedForDelete()) ? DELETION_MASK : 0);
            } 
            dos.writeLong(column.timestamp());
            ByteBufferUtil.writeWithLength(column.value(), dos);
        } 
        catch (IOException e)
        { 
            throw new RuntimeException(e);
        }