Example usage for org.apache.hadoop.io WritableComparator readVLong

List of usage examples for org.apache.hadoop.io WritableComparator readVLong

Introduction

In this page you can find the example usage for org.apache.hadoop.io WritableComparator readVLong.

Prototype

public static long readVLong(byte[] bytes, int start) throws IOException 

Source Link

Document

Reads a zero-compressed encoded long from a byte array and returns it.

Usage

From source file:com.asakusafw.runtime.value.ByteArrayUtil.java

License:Apache License

static long readVLong(byte[] bytes, int offset) {
    try {//  w w  w  .  j a v  a2  s  .  c o  m
        return WritableComparator.readVLong(bytes, offset);
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}

From source file:org.apache.mrql.MR_long.java

License:Apache License

final public static int compare(byte[] x, int xs, int xl, byte[] y, int ys, int yl, int[] size) {
    try {/* ww w  .  jav a 2  s.co  m*/
        size[0] = 1 + WritableUtils.decodeVIntSize(x[xs]);
        long v = WritableComparator.readVLong(x, xs) - WritableComparator.readVLong(y, ys);
        return (v == 0) ? 0 : ((v > 0) ? 1 : -1);
    } catch (IOException e) {
        throw new Error(e);
    }
}