public class ByteArrayBuilder extends Object
byte[]s
where the final size of the
data is not known beforehand. The API is similar to ByteBuffer
but
the data is not actually written to a byte[]
until toBuffer()
or toArray()
is called.Constructor and Description |
---|
ByteArrayBuilder() |
Modifier and Type | Method and Description |
---|---|
int |
position() |
ByteArrayBuilder |
put(byte val) |
ByteArrayBuilder |
put(byte[] val) |
ByteArrayBuilder |
put(ByteBuffer val) |
ByteArrayBuilder |
putInt(int val) |
ByteArrayBuilder |
putInt(int pos,
int val) |
ByteArrayBuilder |
putShort(int pos,
short val) |
ByteArrayBuilder |
putShort(short val) |
ByteArrayBuilder |
reserve(int bytes) |
ByteArrayBuilder |
reserveInt() |
ByteArrayBuilder |
reserveShort() |
byte[] |
toArray() |
ByteBuffer |
toBuffer() |
ByteBuffer |
toBuffer(ByteBuffer buf) |
public int position()
public ByteArrayBuilder reserveInt()
public ByteArrayBuilder reserveShort()
public ByteArrayBuilder reserve(int bytes)
public ByteArrayBuilder put(byte val)
public ByteArrayBuilder putInt(int val)
public ByteArrayBuilder putInt(int pos, int val)
public ByteArrayBuilder putShort(short val)
public ByteArrayBuilder putShort(int pos, short val)
public ByteArrayBuilder put(byte[] val)
public ByteArrayBuilder put(ByteBuffer val)
public ByteBuffer toBuffer()
public ByteBuffer toBuffer(ByteBuffer buf)
public byte[] toArray()
Copyright © 2005–2024 OpenHMS. All rights reserved.