Example usage for org.apache.hadoop.io DataInputBuffer getLength

List of usage examples for org.apache.hadoop.io DataInputBuffer getLength

Introduction

In this page you can find the example usage for org.apache.hadoop.io DataInputBuffer getLength.

Prototype

public int getLength() 

Source Link

Document

Returns the index one greater than the last valid character in the input stream buffer.

Usage

From source file:org.apache.tez.runtime.library.utils.BufferUtils.java

License:Apache License

public static int compare(DataInputBuffer buf1, DataInputBuffer buf2) {
    byte[] b1 = buf1.getData();
    byte[] b2 = buf2.getData();
    int s1 = buf1.getPosition();
    int s2 = buf2.getPosition();
    int l1 = buf1.getLength();
    int l2 = buf2.getLength();
    return FastByteComparisons.compareTo(b1, s1, l1, b2, s2, l2);
}

From source file:org.apache.tez.runtime.library.utils.BufferUtils.java

License:Apache License

public static int compare(DataInputBuffer buf1, DataOutputBuffer buf2) {
    byte[] b1 = buf1.getData();
    byte[] b2 = buf2.getData();
    int s1 = buf1.getPosition();
    int s2 = 0;//from ww w. j  a  va  2s .  c  o m
    int l1 = buf1.getLength();
    int l2 = buf2.getLength();
    return FastByteComparisons.compareTo(b1, s1, (l1 - s1), b2, s2, l2);
}

From source file:org.apache.tez.runtime.library.utils.BufferUtils.java

License:Apache License

public static void copy(DataInputBuffer src, DataOutputBuffer dst) throws IOException {
    byte[] b1 = src.getData();
    int s1 = src.getPosition();
    int l1 = src.getLength();
    dst.reset();/*from  w  ww .  ja  va  2s  . co m*/
    dst.write(b1, s1, l1 - s1);
}