public class ByteArrayBuffer extends Object implements Serializable
ByteArrayBuffer
is a linear byte buffer designed for stream
implementations. Aside from its content, the essential properties of a buffer
are its position and limit.
A buffer's position is the index of the next byte to be read or written. A buffer's position is never negative and is never greater than its limit. A buffer's position changes as individual bytes are being read or written.A buffer's limit is the index of the first byte that should not be read or written. A buffer's limit is never negative and is never greater than its current capacity. A buffer's limit changes as required or as external bulk operations command.
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer
Deprecated.
|
protected int |
limit
Deprecated.
|
protected int |
position
Deprecated.
|
Constructor and Description |
---|
ByteArrayBuffer()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Deprecated.
Clears this buffer.
|
void |
copy(int source_position,
int dest_position,
int length)
Deprecated.
Copies a region of bytes in the buffer.
|
void |
ensureCapacity(int required_capacity)
Deprecated.
Ensures that the byte array has at least the specified capacity.
|
void |
expandLimit(int required_limit)
Deprecated.
Expands byte array to the specified limit (or more).
|
byte[] |
getBuffer()
Deprecated.
Returns the byte array that backs this buffer.
|
int |
getLimit()
Deprecated.
Returns this buffer's limit.
|
int |
getPosition()
Deprecated.
Returns this buffer's position.
|
void |
setBuffer(byte[] new_buffer)
Deprecated.
Sets specified byte array to be used for buffering.
|
void |
setLimit(int new_limit)
Deprecated.
Sets this buffer's limit.
|
void |
setPosition(int new_position)
Deprecated.
Sets this buffer's position.
|
protected byte[] buffer
protected int position
protected int limit
public byte[] getBuffer()
public void setBuffer(byte[] new_buffer)
public int getPosition()
public void setPosition(int new_position)
IllegalArgumentException
- if the new position is negative
or is larger than the current limit.public int getLimit()
public void setLimit(int new_limit)
IllegalArgumentException
- if the new limit is negative
or is larger than the current capacity.public void ensureCapacity(int required_capacity)
public void clear()
public void copy(int source_position, int dest_position, int length)
IndexOutOfBoundsException
- if copying would cause
access of data outside current buffer array bounds.public void expandLimit(int required_limit) throws IOException
This method shall be used internally when position reaches limit. This method may be overriden to change memory management behavior.
IOException
- if an I/O error occurs (expansion impossible).Copyright © 2002–2025 Devexperts LLC. All rights reserved.