public class ByteBuffer extends Object
| Constructor and Description |
|---|
ByteBuffer()
Constructs an empty ByteBuffer so that its internal data array has size
10 and its standard capacity increment is zero.
|
ByteBuffer(int initialCapacity)
Constructs an empty ByteBuffer with the specified initial capacity and
with its capacity increment equal to zero.
|
ByteBuffer(int initialCapacity,
int capacityIncrement)
Constructs an empty ByteBuffer with the specified initial capacity and
capacity increment.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(byte value) |
void |
append(int value) |
void |
append(String value) |
int |
capacity()
Returns the current capacity of this ByteBuffer.
|
boolean |
isEmpty()
Tests if this ByteBuffer has no components.
|
int |
size()
Returns the number of components in this ByteBuffer.
|
byte[] |
toArray()
Returns an array containing all of the elements in this ByteBuffer in the
correct order.
|
void |
trimToSize()
Trims the capacity of this ByteBuffer to be the ByteBuffer's current
size.
|
public ByteBuffer(int initialCapacity,
int capacityIncrement)
initialCapacity - the initial capacity of the ByteBuffer.capacityIncrement - the amount by which the capacity is increased when the
ByteBuffer overflows.IllegalArgumentException - if the specified initial capacity is negativepublic ByteBuffer(int initialCapacity)
initialCapacity - the initial capacity of the ByteBuffer.IllegalArgumentException - if the specified initial capacity is negativepublic ByteBuffer()
public void trimToSize()
public int capacity()
public int size()
public boolean isEmpty()
true if and only if this ByteBuffer has no
components, that is, its size is zero; false
otherwise.public void append(byte value)
public void append(int value)
public void append(String value)
public byte[] toArray()
Copyright © 2020 ADDC Infotech GmbH. All rights reserved.