Package org.springframework.asm
Class ByteVector
- java.lang.Object
- org.springframework.asm.ByteVector
public class ByteVector extends Object
A dynamically extensible vector of bytes. This class is roughly equivalent to a DataOutputStream on top of a ByteArrayOutputStream, but is more efficient.- Author:
- Eric Bruneton
Constructor Summary
Constructors Constructor Description ByteVector()Constructs a newByteVectorwith a default initial size.ByteVector(int initialSize)Constructs a newByteVectorwith the given initial size.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteVectorputByte(int b)Puts a byte into this byte vector.ByteVectorputByteArray(byte[] b, int off, int len)Puts an array of bytes into this byte vector.ByteVectorputInt(int i)Puts an int into this byte vector.ByteVectorputLong(long l)Puts a long into this byte vector.ByteVectorputShort(int s)Puts a short into this byte vector.ByteVectorputUTF8(String s)Puts an UTF8 string into this byte vector.
Constructor Detail
ByteVector
public ByteVector()
Constructs a newByteVectorwith a default initial size.
ByteVector
public ByteVector(int initialSize)
Constructs a newByteVectorwith the given initial size.- Parameters:
initialSize- the initial size of the byte vector to be constructed.
Method Detail
putByte
public ByteVector putByte(int b)
Puts a byte into this byte vector. The byte vector is automatically enlarged if necessary.- Parameters:
b- a byte.- Returns:
- this byte vector.
putShort
public ByteVector putShort(int s)
Puts a short into this byte vector. The byte vector is automatically enlarged if necessary.- Parameters:
s- a short.- Returns:
- this byte vector.
putInt
public ByteVector putInt(int i)
Puts an int into this byte vector. The byte vector is automatically enlarged if necessary.- Parameters:
i- an int.- Returns:
- this byte vector.
putLong
public ByteVector putLong(long l)
Puts a long into this byte vector. The byte vector is automatically enlarged if necessary.- Parameters:
l- a long.- Returns:
- this byte vector.
putUTF8
public ByteVector putUTF8(String s)
Puts an UTF8 string into this byte vector. The byte vector is automatically enlarged if necessary.- Parameters:
s- a String whose UTF8 encoded length must be less than 65536.- Returns:
- this byte vector.
putByteArray
public ByteVector putByteArray(byte[] b, int off, int len)
Puts an array of bytes into this byte vector. The byte vector is automatically enlarged if necessary.- Parameters:
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.- Returns:
- this byte vector.