Package org.openjdk.asmtools.jcoder
Class ByteBuffer
java.lang.Object
java.io.OutputStream
org.openjdk.asmtools.jcoder.ByteBuffer
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Compiles just 1 source file
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
The size of the increment.(package private) byte[]
The buffer where elements are stored.(package private) int
The number of elements in the buffer.(package private) String
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty vector.ByteBuffer
(byte[] data) Constructs a full vector.ByteBuffer
(byte[] data, int capacityIncrement) Constructs a full vector.ByteBuffer
(int initialCapacity) Constructs an empty vector with the specified storage capacity.ByteBuffer
(int initialCapacity, int capacityIncrement) Constructs an empty vector with the specified storage capacity and the specified capacityIncrement. -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(long val, int width) final void
ensureCapacity
(int minCapacity) Ensures that the vector has at least the specified capacity.final int
size()
Returns the number of elements in the vector.void
write
(int val) void
writeAt
(int index, long val, int width) Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write, write
-
Field Details
-
myname
String myname -
data
byte[] dataThe buffer where elements are stored. -
length
int lengthThe number of elements in the buffer. -
capacityIncrement
protected int capacityIncrementThe size of the increment. If it is 0 the size of the the buffer is doubled everytime it needs to grow.
-
-
Constructor Details
-
ByteBuffer
public ByteBuffer(int initialCapacity, int capacityIncrement) Constructs an empty vector with the specified storage capacity and the specified capacityIncrement.- Parameters:
initialCapacity
- the initial storage capacity of the vectorcapacityIncrement
- how much to increase the element's size by.
-
ByteBuffer
public ByteBuffer(int initialCapacity) Constructs an empty vector with the specified storage capacity.- Parameters:
initialCapacity
- the initial storage capacity of the vector
-
ByteBuffer
public ByteBuffer()Constructs an empty vector. -
ByteBuffer
public ByteBuffer(byte[] data, int capacityIncrement) Constructs a full vector. -
ByteBuffer
public ByteBuffer(byte[] data) Constructs a full vector.
-
-
Method Details
-
size
public final int size()Returns the number of elements in the vector. Note that this is not the same as the vector's capacity. -
ensureCapacity
public final void ensureCapacity(int minCapacity) Ensures that the vector has at least the specified capacity.- Parameters:
minCapacity
- the desired minimum capacity
-
write
public void write(int val) - Specified by:
write
in classOutputStream
-
writeAt
public void writeAt(int index, long val, int width) -
append
public void append(long val, int width)
-