public class ByteVector extends Object
Constructor and Description |
---|
ByteVector()
Constructs a new
ByteVector with a default initial capacity. |
ByteVector(int initialCapacity)
Constructs a new
ByteVector with the given initial capacity. |
Modifier and Type | Method and Description |
---|---|
ByteVector |
putByte(int byteValue)
Puts a byte into this byte vector.
|
ByteVector |
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.
|
ByteVector |
putLong(long longValue)
Puts a long into this byte vector.
|
ByteVector |
putShort(int shortValue)
Puts a short into this byte vector.
|
ByteVector |
putUTF8(String stringValue)
Puts an UTF8 string into this byte vector.
|
int |
size()
Returns the actual number of bytes in this vector.
|
public ByteVector()
ByteVector
with a default initial capacity.public ByteVector(int initialCapacity)
ByteVector
with the given initial capacity.initialCapacity
- the initial capacity of the byte vector to be constructed.public int size()
public ByteVector putByte(int byteValue)
byteValue
- a byte.public ByteVector putShort(int shortValue)
shortValue
- a short.public ByteVector putInt(int intValue)
intValue
- an int.public ByteVector putLong(long longValue)
longValue
- a long.public ByteVector putUTF8(String stringValue)
stringValue
- a String whose UTF8 encoded length must be less than 65536.public ByteVector 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.