List of usage examples for org.apache.lucene.store ByteArrayDataInput readByte
@Override
public byte readByte()
From source file:org.codelibs.elasticsearch.common.util.ByteUtils.java
License:Apache License
/** Same as DataOutput#readVLong but can read negative values (read on 9 bytes). */ public static long readVLong(ByteArrayDataInput in) { // unwinded because of hotspot bugs, see Lucene's impl byte b = in.readByte(); if (b >= 0) { return b; }//from w w w. j a v a2s . c o m long i = b & 0x7FL; b = in.readByte(); i |= (b & 0x7FL) << 7; if (b >= 0) { return i; } b = in.readByte(); i |= (b & 0x7FL) << 14; if (b >= 0) { return i; } b = in.readByte(); i |= (b & 0x7FL) << 21; if (b >= 0) { return i; } b = in.readByte(); i |= (b & 0x7FL) << 28; if (b >= 0) { return i; } b = in.readByte(); i |= (b & 0x7FL) << 35; if (b >= 0) { return i; } b = in.readByte(); i |= (b & 0x7FL) << 42; if (b >= 0) { return i; } b = in.readByte(); i |= (b & 0x7FL) << 49; if (b >= 0) { return i; } b = in.readByte(); i |= (b & 0xFFL) << 56; return i; }
From source file:org.elasticsearch.common.util.ByteUtils.java
License:Apache License
/** Same as DataOutput#readVLong but can read negative values (read on 9 bytes). */ public static long readVLong(ByteArrayDataInput in) { // unwinded because of hotspot bugs, see Lucene's impl byte b = in.readByte(); if (b >= 0) return b; long i = b & 0x7FL; b = in.readByte();//from w w w . j av a 2 s .co m i |= (b & 0x7FL) << 7; if (b >= 0) return i; b = in.readByte(); i |= (b & 0x7FL) << 14; if (b >= 0) return i; b = in.readByte(); i |= (b & 0x7FL) << 21; if (b >= 0) return i; b = in.readByte(); i |= (b & 0x7FL) << 28; if (b >= 0) return i; b = in.readByte(); i |= (b & 0x7FL) << 35; if (b >= 0) return i; b = in.readByte(); i |= (b & 0x7FL) << 42; if (b >= 0) return i; b = in.readByte(); i |= (b & 0x7FL) << 49; if (b >= 0) return i; b = in.readByte(); i |= (b & 0xFFL) << 56; return i; }