Example usage for org.apache.lucene.store ByteArrayDataOutput writeByte

List of usage examples for org.apache.lucene.store ByteArrayDataOutput writeByte

Introduction

In this page you can find the example usage for org.apache.lucene.store ByteArrayDataOutput writeByte.

Prototype

@Override
    public void writeByte(byte b) 

Source Link

Usage

From source file:org.codelibs.elasticsearch.common.util.ByteUtils.java

License:Apache License

/** Same as DataOutput#writeVLong but accepts negative values (written on 9 bytes). */
public static void writeVLong(ByteArrayDataOutput out, long i) {
    for (int k = 0; k < 8 && (i & ~0x7FL) != 0L; ++k) {
        out.writeByte((byte) ((i & 0x7FL) | 0x80L));
        i >>>= 7;/*from  w w w  .  ja v  a 2  s .c om*/
    }
    out.writeByte((byte) i);
}