Code example for DataInput

Methods: readDouble, readUTF

0
        this.score = score;
    } 
 
    @Override 
    public void readFields(DataInput in) throws IOException {
        score = in.readDouble();
        document = in.readUTF();
    } 
 
    @Override 
    public void write(DataOutput out) throws IOException {
        out.writeDouble(score);
        out.writeUTF(document);
    } 
 
    public String getDocument() {
        return document;
    } 
 
    public void setDocument(String document) {
        this.document = document;