|
Berkeley DB version 5.3.21 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.util.PackedInteger
public class PackedInteger
Static methods for reading and writing packed integers.
Most applications should use the classes in the com.sleepycat.bind.tuple
package rather than using this class directly.
Field Summary | |
---|---|
static int |
MAX_LENGTH
The maximum number of bytes needed to store an int value (5). |
static int |
MAX_LONG_LENGTH
The maximum number of bytes needed to store a long value (9). |
Constructor Summary | |
---|---|
PackedInteger()
|
Method Summary | |
---|---|
static int |
getReadIntLength(byte[] buf,
int off)
Returns the number of bytes that would be read by readInt(byte[], int) . |
static int |
getReadLongLength(byte[] buf,
int off)
Returns the number of bytes that would be read by readLong(byte[], int) . |
static int |
getReadSortedIntLength(byte[] buf,
int off)
Returns the number of bytes that would be read by readSortedInt(byte[], int) . |
static int |
getReadSortedLongLength(byte[] buf,
int off)
Returns the number of bytes that would be read by readSortedLong(byte[], int) . |
static int |
getWriteIntLength(int value)
Returns the number of bytes that would be written by writeInt(byte[], int, int) . |
static int |
getWriteLongLength(long value)
Returns the number of bytes that would be written by writeLong(byte[], int, long) . |
static int |
getWriteSortedIntLength(int value)
Returns the number of bytes that would be written by writeSortedInt(byte[], int, int) . |
static int |
getWriteSortedLongLength(long value)
Returns the number of bytes that would be written by writeSortedLong(byte[], int, long) . |
static int |
readInt(byte[] buf,
int off)
Reads a packed integer at the given buffer offset and returns it. |
static long |
readLong(byte[] buf,
int off)
Reads a packed long integer at the given buffer offset and returns it. |
static int |
readSortedInt(byte[] buf,
int off)
Reads a sorted packed integer at the given buffer offset and returns it. |
static long |
readSortedLong(byte[] buf,
int off)
Reads a sorted packed long integer at the given buffer offset and returns it. |
static int |
writeInt(byte[] buf,
int offset,
int value)
Writes a packed integer starting at the given buffer offset and returns the next offset to be written. |
static int |
writeLong(byte[] buf,
int offset,
long value)
Writes a packed long integer starting at the given buffer offset and returns the next offset to be written. |
static int |
writeSortedInt(byte[] buf,
int offset,
int value)
Writes a packed sorted integer starting at the given buffer offset and returns the next offset to be written. |
static int |
writeSortedLong(byte[] buf,
int offset,
long value)
Writes a packed sorted long integer starting at the given buffer offset and returns the next offset to be written. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_LENGTH
public static final int MAX_LONG_LENGTH
Constructor Detail |
---|
public PackedInteger()
Method Detail |
---|
public static int readInt(byte[] buf, int off)
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static long readLong(byte[] buf, int off)
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static int getReadIntLength(byte[] buf, int off)
readInt(byte[], int)
.
Because the length is stored in the first byte, this method may be called with only the first byte of the packed integer in the given buffer. This method only accesses one byte at the given offset.
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static int getReadLongLength(byte[] buf, int off)
readLong(byte[], int)
.
Because the length is stored in the first byte, this method may be called with only the first byte of the packed integer in the given buffer. This method only accesses one byte at the given offset.
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static int writeInt(byte[] buf, int offset, int value)
buf
- the buffer to write to.offset
- the offset in the buffer at which to start writing.value
- the integer to be written.
public static int writeLong(byte[] buf, int offset, long value)
buf
- the buffer to write to.offset
- the offset in the buffer at which to start writing.value
- the long integer to be written.
public static int getWriteIntLength(int value)
writeInt(byte[], int, int)
.
value
- the integer to be written.
public static int getWriteLongLength(long value)
writeLong(byte[], int, long)
.
value
- the long integer to be written.
public static int readSortedInt(byte[] buf, int off)
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static long readSortedLong(byte[] buf, int off)
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static int getReadSortedIntLength(byte[] buf, int off)
readSortedInt(byte[], int)
.
Because the length is stored in the first byte, this method may be called with only the first byte of the packed integer in the given buffer. This method only accesses one byte at the given offset.
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static int getReadSortedLongLength(byte[] buf, int off)
readSortedLong(byte[], int)
.
Because the length is stored in the first byte, this method may be called with only the first byte of the packed integer in the given buffer. This method only accesses one byte at the given offset.
buf
- the buffer to read from.off
- the offset in the buffer at which to start reading.
public static int writeSortedInt(byte[] buf, int offset, int value)
buf
- the buffer to write to.offset
- the offset in the buffer at which to start writing.value
- the integer to be written.
public static int writeSortedLong(byte[] buf, int offset, long value)
buf
- the buffer to write to.offset
- the offset in the buffer at which to start writing.value
- the long integer to be written.
public static int getWriteSortedIntLength(int value)
writeSortedInt(byte[], int, int)
.
value
- the integer to be written.
public static int getWriteSortedLongLength(long value)
writeSortedLong(byte[], int, long)
.
value
- the long integer to be written.
|
Berkeley DB version 5.3.21 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |