|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.logicalcobwebs.asm.ByteVector
final class ByteVector
A dynamically extensible vector of bytes. This class is roughly equivalent to a DataOutputStream on top of a ByteArrayOutputStream, but is more efficient.
Field Summary | |
---|---|
(package private) byte[] |
data
The content of this vector. |
(package private) int |
length
Actual number of bytes in this vector. |
Constructor Summary | |
---|---|
ByteVector()
Constructs a new ByteVector with a default initial size. |
|
ByteVector(int initialSize)
Constructs a new ByteVector with the given initial size. |
Method Summary | |
---|---|
private void |
enlarge(int size)
Enlarge this byte vector so that it can receive n more bytes. |
ByteVector |
put1(int b)
Puts a byte into this byte vector. |
ByteVector |
put11(int b1,
int b2)
Puts two bytes into this byte vector. |
ByteVector |
put12(int b,
int s)
Puts a byte and a short into this byte vector. |
ByteVector |
put2(int s)
Puts a short into this byte vector. |
ByteVector |
put4(int i)
Puts an int into this byte vector. |
ByteVector |
put8(long l)
Puts a long into this byte vector. |
ByteVector |
putByteArray(byte[] b,
int off,
int len)
Puts an array of bytes into this byte vector. |
ByteVector |
putUTF(java.lang.String s)
Puts a String in UTF format into this byte vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
byte[] data
int length
Constructor Detail |
---|
public ByteVector()
ByteVector
with a default initial size.
public ByteVector(int initialSize)
ByteVector
with the given initial size.
initialSize
- the initial size of the byte vector to be constructed.Method Detail |
---|
public ByteVector put1(int b)
b
- a byte.
public ByteVector put11(int b1, int b2)
b1
- a byte.b2
- another byte.
public ByteVector put2(int s)
s
- a short.
public ByteVector put12(int b, int s)
b
- a byte.s
- a short.
public ByteVector put4(int i)
i
- an int.
public ByteVector put8(long l)
l
- a long.
public ByteVector putUTF(java.lang.String s)
s
- a String.
public ByteVector putByteArray(byte[] b, int off, int len)
b
- an array of bytes. May be null to put len null
bytes into this byte vector.off
- index of the fist byte of b that must be copied.len
- number of bytes of b that must be copied.
private void enlarge(int size)
size
- number of additional bytes that this byte vector should be
able to receive.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |