Code example for DataInput

Methods: readUTF

0
        out.writeUTF(this.label);
    } 
 
    public void readFields(final DataInput in) throws IOException {
        super.readFields(in);
        this.inVertex = WritableUtils.readVLong(in);
        this.outVertex = WritableUtils.readVLong(in);
        //setLabel(WritableUtils.readCompressedString(in)); 
        setLabel(in.readUTF());
    } 
 
    public void writeCompressed(final DataOutput out, final Direction idToWrite) throws IOException {
        super.write(out);
        if (idToWrite.equals(Direction.IN))
            WritableUtils.writeVLong(out, this.inVertex);
        else if (idToWrite.equals(Direction.OUT))
            WritableUtils.writeVLong(out, this.outVertex);
        else 
            throw ExceptionFactory.bothIsNotSupported(); 
    }