Java Code Examples for org.apache.lucene.util.BitUtil#zigZagDecode()
The following examples show how to use
org.apache.lucene.util.BitUtil#zigZagDecode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompressingStoredFieldsReader.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Reads a long in a variable-length format. Reads between one andCorePropLo * nine bytes. Small values typically take fewer bytes. */ static long readTLong(DataInput in) throws IOException { int header = in.readByte() & 0xFF; long bits = header & 0x1F; if ((header & 0x20) != 0) { // continuation bit bits |= in.readVLong() << 5; } long l = BitUtil.zigZagDecode(bits); switch (header & DAY_ENCODING) { case SECOND_ENCODING: l *= SECOND; break; case HOUR_ENCODING: l *= HOUR; break; case DAY_ENCODING: l *= DAY; break; case 0: // uncompressed break; default: throw new AssertionError(); } return l; }
Example 2
Source File: StreamInput.java From crate with Apache License 2.0 | 5 votes |
public long readZLong() throws IOException { long accumulator = 0L; int i = 0; long currentByte; while (((currentByte = readByte()) & 0x80L) != 0) { accumulator |= (currentByte & 0x7F) << i; i += 7; if (i > 63) { throw new IOException("variable-length stream is too long"); } } return BitUtil.zigZagDecode(accumulator | (currentByte << i)); }
Example 3
Source File: DataInput.java From lucene-solr with Apache License 2.0 | 2 votes |
/** * Read a {@link BitUtil#zigZagDecode(int) zig-zag}-encoded * {@link #readVInt() variable-length} integer. * @see DataOutput#writeZInt(int) */ public int readZInt() throws IOException { return BitUtil.zigZagDecode(readVInt()); }
Example 4
Source File: DataInput.java From lucene-solr with Apache License 2.0 | 2 votes |
/** * Read a {@link BitUtil#zigZagDecode(long) zig-zag}-encoded * {@link #readVLong() variable-length} integer. Reads between one and ten * bytes. * @see DataOutput#writeZLong(long) */ public long readZLong() throws IOException { return BitUtil.zigZagDecode(readVLong(true)); }