public class GridByteArrayList extends Object implements Message, Externalizable
| Constructor and Description |
|---|
GridByteArrayList()
No-op constructor that creates uninitialized list.
|
GridByteArrayList(byte[] data)
Wraps existing array into byte array list.
|
GridByteArrayList(byte[] data,
int size)
Wraps existing array into byte array list.
|
GridByteArrayList(int cap)
Creates empty list with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(byte b)
Appends byte element to the list.
|
void |
add(byte[] bytes,
int off,
int len) |
void |
add(ByteBuffer buf,
int len)
Adds data from byte buffer into array.
|
void |
add(int i)
Appends integer to the next 4 bytes of list.
|
void |
add(long l)
Appends long to the next 8 bytes of list.
|
void |
add(short i)
Appends short to the next 2 bytes of the list.
|
void |
allocate(int cnt)
Pre-allocates internal array for specified byte number only
if it currently is smaller than desired number.
|
byte[] |
array()
Gets copy of internal array.
|
int |
capacity()
Gets initial capacity of the list.
|
byte |
directType()
Gets message type.
|
byte[] |
entireArray()
Returns internal array if it represents the whole length,
otherwise returns the result of
array(). |
byte |
fieldsCount()
Gets fields count.
|
byte |
get(int i)
Gets the element (byte) at the specified position in the list.
|
int |
getInt(int i)
Gets 4 bytes from byte list as an integer.
|
InputStream |
inputStream() |
byte[] |
internalArray()
Returns the underlying array.
|
OutputStream |
outputStream() |
void |
readAll(InputStream in)
Reads all data from input stream until the end into this byte list.
|
void |
readExternal(ObjectInput in) |
boolean |
readFrom(ByteBuffer buf,
MessageReader reader)
Reads this message from provided byte buffer.
|
void |
reset()
Resets byte array to empty.
|
void |
set(int pos,
byte b)
Sets a byte at specified position.
|
void |
set(int pos,
int i)
Sets integer at specified position.
|
void |
set(int pos,
long l)
Sets long at specified position.
|
void |
set(int pos,
short i)
Sets short at specified position.
|
int |
size()
Gets number of bytes in the list.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
boolean |
writeTo(ByteBuffer buf,
MessageWriter writer)
Writes this message to provided byte buffer.
|
public GridByteArrayList()
Externalizable interface.public GridByteArrayList(int cap)
cap - Initial capacity.public GridByteArrayList(byte[] data,
int size)
data - Array to wrap.size - Size of data inside of array.public GridByteArrayList(byte[] data)
data - Array to wrap.public void reset()
public byte[] internalArray()
public byte[] array()
public byte[] entireArray()
array().public int capacity()
public int size()
public void allocate(int cnt)
cnt - Byte number to preallocate.public void add(byte b)
b - Byte value to append.public void set(int pos,
byte b)
pos - Specified position.b - Byte to set.public void add(int i)
i - Integer to append.public void add(short i)
i - Short to append.public void set(int pos,
short i)
pos - Specified position.i - Short to set.public void set(int pos,
int i)
pos - Specified position.i - Integer to set.public void add(long l)
l - Long to append.public void set(int pos,
long l)
pos - Specified position.l - Long to set.public void add(byte[] bytes,
int off,
int len)
bytes - Byte to add.off - Offset at which to add.len - Number of bytes to add.public void add(ByteBuffer buf, int len)
buf - Buffer to read bytes from.len - Number of bytes to add.public byte get(int i)
i - Index of element to return.public int getInt(int i)
i - Index into the byte list.public void readAll(InputStream in) throws IOException
in - Input stream to read from.IOException - Thrown if any I/O error occurred.public OutputStream outputStream()
public InputStream inputStream()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic boolean writeTo(ByteBuffer buf, MessageWriter writer)
public boolean readFrom(ByteBuffer buf, MessageReader reader)
public byte directType()
directType in interface Messagepublic byte fieldsCount()
fieldsCount in interface Message
Follow @ApacheIgnite
Ignite Fabric : ver. 1.1.0-incubating Release Date : May 20 2015