public class ByteVector
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) byte[] |
data
The content of this vector.
|
(package private) int |
length
The actual number of bytes in this vector.
|
| Constructor and Description |
|---|
ByteVector(int initialCapacity)
Constructs a new
ByteVector with the given initial capacity. |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
encodeUtf8(java.lang.String stringValue,
int offset)
Puts an UTF8 string into this byte vector.
|
private void |
enlarge(int size)
Enlarges this byte vector so that it can receive 'size' more bytes.
|
(package private) void |
put11(int byteValue1,
int byteValue2)
Puts two bytes into this byte vector.
|
(package private) ByteVector |
put12(int byteValue,
int shortValue)
Puts a byte and a short into this byte vector.
|
(package private) void |
put122(int byteValue,
int shortValue1,
int shortValue2)
Puts one byte and two shorts into this byte vector.
|
ByteVector |
putByte(int byteValue)
Puts a byte into this byte vector.
|
void |
putByteArray(byte[] byteArrayValue,
int byteOffset,
int byteLength)
Puts an array of bytes into this byte vector.
|
ByteVector |
putInt(int intValue)
Puts an int into this byte vector.
|
void |
putLong(long longValue)
Puts a long into this byte vector.
|
ByteVector |
putShort(int shortValue)
Puts a short into this byte vector.
|
void |
putUTF8(java.lang.String stringValue)
Puts an UTF8 string into this byte vector.
|
byte[] data
length bytes contain real data.int length
public ByteVector(int initialCapacity)
ByteVector with the given initial capacity.initialCapacity - the initial capacity of the byte vector to be constructed.public ByteVector putByte(int byteValue)
byteValue - a byte.final void put11(int byteValue1,
int byteValue2)
byteValue1 - a byte.byteValue2 - another byte.public ByteVector putShort(int shortValue)
shortValue - a short.final ByteVector put12(int byteValue, int shortValue)
byteValue - a byte.shortValue - a short.public ByteVector putInt(int intValue)
intValue - an int.final void put122(int byteValue,
int shortValue1,
int shortValue2)
byteValue - a byte.shortValue1 - a short.shortValue2 - another short.public void putLong(long longValue)
longValue - a long.public void putUTF8(java.lang.String stringValue)
stringValue - a String whose UTF8 encoded length must be less than 65536.final void encodeUtf8(java.lang.String stringValue,
int offset)
stringValue - the String to encode.offset - the index of the first character to encode. The previous characters are supposed
to have already been encoded, using only one byte per character.public void putByteArray(byte[] byteArrayValue,
int byteOffset,
int byteLength)
byteArrayValue - an array of bytes. May be null to put byteLength null
bytes into this byte vector.byteOffset - index of the first byte of byteArrayValue that must be copied.byteLength - number of bytes of byteArrayValue that must be copied.private void enlarge(int size)
size - number of additional bytes that this byte vector should be able to receive.