Code example for DataInput

Methods: readLong

0
    public long getLength() throws IOException { 
        return end - start;
    } 
 
    public void readFields(DataInput input) throws IOException {
        start = input.readLong();
        end = input.readLong();
    } 
 
    public void write(DataOutput output) throws IOException {
        output.writeLong(start);
        output.writeLong(end);
    } 
 
    @Override 
    public String toString() {
        return String.format("Split at [%s to %s]", this.start, this.end == Long.MAX_VALUE ? "END" : this.end - 1);
    } 
}