|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.simpleframework.util.buffer.ArrayBuffer
public class ArrayBuffer
The ArrayBuffer is intended to be a general purpose
byte buffer that stores bytes in an single internal byte array. The
intended use of this buffer is to provide a simple buffer object to
read and write bytes with. In particular this provides a high
performance buffer that can be used to read and write bytes fast.
This provides several convenience methods which make the use of the
buffer easy and useful. This buffer allows an initial capacity to be
specified however if there is a need for extra space to be added to
buffer then the append methods will expand the capacity
of the buffer as needed.
ArrayAllocator| Constructor Summary | |
|---|---|
ArrayBuffer()
Constructor for the ArrayBuffer object. |
|
ArrayBuffer(int size)
Constructor for the ArrayBuffer object. |
|
ArrayBuffer(int size,
int limit)
Constructor for the ArrayBuffer object. |
|
| Method Summary | |
|---|---|
Buffer |
allocate()
This method is used to allocate a segment of this buffer as a separate buffer object. |
Buffer |
append(byte[] array)
This method is used to append bytes to the end of the buffer. |
Buffer |
append(byte[] array,
int off,
int size)
This method is used to append bytes to the end of the buffer. |
void |
clear()
This will clear all data from the buffer. |
void |
close()
This method is used to ensure the buffer can be closed. |
String |
encode()
This method is used to acquire the buffered bytes as a string. |
String |
encode(String charset)
This method is used to acquire the buffered bytes as a string. |
long |
length()
This is used to provide the number of bytes that have been written to the buffer. |
InputStream |
open()
This method is used so that the buffer can be represented as a stream of bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayBuffer()
ArrayBuffer object. The initial
capacity of the default buffer object is set to 16, the capacity
will be expanded when the append methods are used and there is
not enough space to accommodate the extra bytes.
public ArrayBuffer(int size)
ArrayBuffer object. The initial
capacity of the buffer object is set to given size, the capacity
will be expanded when the append methods are used and there is
not enough space to accommodate the extra bytes.
size - the initial capacity of this buffer instance
public ArrayBuffer(int size,
int limit)
ArrayBuffer object. The initial
capacity of the buffer object is set to given size, the capacity
will be expanded when the append methods are used and there is
not enough space to accommodate the extra bytes.
size - the initial capacity of this buffer instancelimit - this is the maximum allowable buffer capacity| Method Detail |
|---|
public InputStream open()
open in interface Buffer
public Buffer allocate()
throws IOException
allocate in interface BufferIOException
public String encode()
throws IOException
encode in interface BufferIOException
public String encode(String charset)
throws IOException
encode in interface Buffercharset - this is the charset to encode the data with
IOException
public Buffer append(byte[] array)
throws IOException
append in interface Bufferarray - this is the byte array to append to this buffer
IOException
public Buffer append(byte[] array,
int off,
int size)
throws IOException
append in interface Bufferarray - this is the byte array to append to this bufferoff - this is the offset to begin reading the bytes fromsize - the number of bytes to be read from the array
IOException
public void clear()
throws IOException
clear in interface BufferIOException
public void close()
throws IOException
close in interface BufferIOExceptionpublic long length()
length in interface Buffer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||