|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simpleframework.util.buffer.ArrayAllocator
public class ArrayAllocator
The ArrayAllocator
object is used to provide a means
to allocate buffers using a single byte array. This essentially uses
the heap to allocate all buffers. As a result the performance of the
resulting buffers is good, however for very large buffers this will
use quote allot of the usable heap space. For very large buffers a
mapped region of shared memory of a file should be considered.
Constructor Summary | |
---|---|
ArrayAllocator()
Constructor for the ArrayAllocator object. |
|
ArrayAllocator(int size)
Constructor for the ArrayAllocator object. |
|
ArrayAllocator(int size,
int limit)
Constructor for the ArrayAllocator object. |
Method Summary | |
---|---|
Buffer |
allocate()
This method is used to allocate a default buffer. |
Buffer |
allocate(int size)
This method is used to allocate a default buffer. |
void |
close()
This method is used to close the allocator so that resources that are occupied by the allocator can be freed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayAllocator()
ArrayAllocator
object. This is
used to instantiate the allocator with a default buffer size of
half a kilobyte. This ensures that it can be used for general
purpose byte storage and for minor I/O tasks.
public ArrayAllocator(int size)
ArrayAllocator
object. This is
used to instantiate the allocator with a specified buffer size.
This is typically used when a very specific buffer capacity is
required, for example a request body with a known length.
size
- the initial capacity of the allocated bufferspublic ArrayAllocator(int size, int limit)
ArrayAllocator
object. This is
used to instantiate the allocator with a specified buffer size.
This is typically used when a very specific buffer capacity is
required, for example a request body with a known length.
size
- the initial capacity of the allocated bufferslimit
- this is the maximum buffer size created by thisMethod Detail |
---|
public Buffer allocate() throws java.io.IOException
allocate
in interface Allocator
java.io.IOException
public Buffer allocate(int size) throws java.io.IOException
allocate
in interface Allocator
size
- the initial capacity of the allocated buffer
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface Allocator
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |