com.devexperts.qd.util
Class CompactInt

java.lang.Object
  extended by com.devexperts.qd.util.CompactInt

Deprecated. Use IOUtil class instead.

public class CompactInt
extends java.lang.Object

The CompactInt utility class provides algorithms for compact serialization of integer numbers. It uses encoding scheme with variable-length two's complement big-endian format capable to encode 64-bits signed numbers.

The following table defines used serial format (the first byte is given in bits with 'x' representing payload bit; the remaining bytes are given in bit count):

 0xxxxxxx     - for -64 <= N < 64
 10xxxxxx  8x - for -8192 <= N < 8192
 110xxxxx 16x - for -1048576 <= N < 1048576
 1110xxxx 24x - for -134217728 <= N < 134217728
 11110xxx 32x - for -17179869184 <= N < 17179869184 (includes whole range of signed int)
 111110xx 40x - for -2199023255552 <= N < 2199023255552
 1111110x 48x - for -281474976710656 <= N < 281474976710656
 11111110 56x - for -36028797018963968 <= N < 36028797018963968
 11111111 64x - for -9223372036854775808 <= N < 9223372036854775808 (the range of signed long)
 

Note: this class is deprecated and is replaced by IOUtil class. See IOUtil class, section CompactInt, and individual methods for documentation.


Method Summary
static int getIntLength(int n)
          Deprecated. Use IOUtil.getCompactLength(long) method instead.
static int readInt(java.io.DataInput in)
          Deprecated. Use IOUtil.readCompactInt(java.io.DataInput) method instead.
static long readLong(java.io.DataInput in)
          Deprecated. Use IOUtil.readCompactLong(java.io.DataInput) method instead.
static void writeInt(java.io.DataOutput out, int n)
          Deprecated. Use IOUtil.writeCompactInt(java.io.DataOutput, int) method instead.
static void writeLong(java.io.DataOutput out, long l)
          Deprecated. Use IOUtil.writeCompactLong(java.io.DataOutput, long) method instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getIntLength

public static int getIntLength(int n)
Deprecated. Use IOUtil.getCompactLength(long) method instead.

Returns number of bytes that are needed to write a specified integer in a compact form.


writeInt

public static void writeInt(java.io.DataOutput out,
                            int n)
                     throws java.io.IOException
Deprecated. Use IOUtil.writeCompactInt(java.io.DataOutput, int) method instead.

Writes specified integer to the specified data output in a compact form.

Throws:
java.io.IOException

readInt

public static int readInt(java.io.DataInput in)
                   throws java.io.IOException
Deprecated. Use IOUtil.readCompactInt(java.io.DataInput) method instead.

Reads integer from specified data input in a compact form. If encoded number does not fit into int data type, then loss of precision occurs as it is type casted into int; the number is read entirely in this case.

Throws:
java.io.IOException

writeLong

public static void writeLong(java.io.DataOutput out,
                             long l)
                      throws java.io.IOException
Deprecated. Use IOUtil.writeCompactLong(java.io.DataOutput, long) method instead.

Writes specified long to the specified data output in a compact form.

Throws:
java.io.IOException

readLong

public static long readLong(java.io.DataInput in)
                     throws java.io.IOException
Deprecated. Use IOUtil.readCompactLong(java.io.DataInput) method instead.

Reads long from specified data input in a compact form.

Throws:
java.io.IOException