public final class LongPacker
extends java.lang.Object
long
and int
values.
Originally developed for Kryo by Nathan Sweet. Modified for JDBM by Jan KotekModifier and Type | Method and Description |
---|---|
static int |
packInt(java.io.DataOutput os,
int value)
Pack non-negative int into output stream.
|
static int |
packLong(byte[] ba,
long value)
Pack non-negative long into byte array.
|
static int |
packLong(java.io.DataOutput os,
long value)
Pack non-negative long into output stream.
|
static int |
unpackInt(java.nio.ByteBuffer bb)
Unpack positive int value from the input byte buffer.
|
static int |
unpackInt(java.io.DataInput is)
Unpack positive int value from the input stream.
|
static long |
unpackLong(byte[] ba)
Unpack positive long value from the byte array.
|
static long |
unpackLong(byte[] ba,
int index)
Unpack positive long value from the byte array.
|
static long |
unpackLong(java.io.DataInput is)
Unpack positive long value from the input stream.
|
public static int packLong(java.io.DataOutput os, long value) throws java.io.IOException
os
- the data outputvalue
- the long valuejava.io.IOException
- if an error occurs with the streampublic static int packLong(byte[] ba, long value) throws java.io.IOException
ba
- the byte arrayvalue
- the long valuejava.io.IOException
- if an error occurs with the streampublic static long unpackLong(java.io.DataInput is) throws java.io.IOException
is
- The input stream.java.io.IOException
- if an error occurs with the streampublic static long unpackLong(byte[] ba)
ba
- byte arraypublic static long unpackLong(byte[] ba, int index)
The index value indicates the index in the given byte array.
ba
- byte arrayindex
- index in bapublic static int packInt(java.io.DataOutput os, int value) throws java.io.IOException
os
- the data outputvalue
- the valuejava.io.IOException
- if an error occurs with the streampublic static int unpackInt(java.io.DataInput is) throws java.io.IOException
is
- The input stream.java.io.IOException
- if an error occurs with the streampublic static int unpackInt(java.nio.ByteBuffer bb) throws java.io.IOException
bb
- The byte bufferjava.io.IOException
- if an error occurs with the stream