Package org.openjdk.asmtools.jcoder
Class ByteBuffer
- java.lang.Object
-
- java.io.OutputStream
-
- org.openjdk.asmtools.jcoder.ByteBuffer
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
class ByteBuffer extends java.io.OutputStream
Compiles just 1 source file
-
-
Field Summary
Fields Modifier and Type Field Description protected int
capacityIncrement
The size of the increment.(package private) byte[]
data
The buffer where elements are stored.(package private) int
length
The number of elements in the buffer.(package private) java.lang.String
myname
-
Constructor Summary
Constructors Constructor Description ByteBuffer()
Constructs 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(long val, int width)
void
ensureCapacity(int minCapacity)
Ensures that the vector has at least the specified capacity.int
size()
Returns the number of elements in the vector.void
write(int val)
void
writeAt(int index, long val, int width)
-
-
-
Field Detail
-
myname
java.lang.String myname
-
data
byte[] data
The buffer where elements are stored.
-
length
int length
The number of elements in the buffer.
-
capacityIncrement
protected int capacityIncrement
The size of the increment. If it is 0 the size of the the buffer is doubled everytime it needs to grow.
-
-
Constructor Detail
-
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 Detail
-
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 classjava.io.OutputStream
-
writeAt
public void writeAt(int index, long val, int width)
-
append
public void append(long val, int width)
-
-