public class FileAllocator extends java.lang.Object implements Allocator
FileAllocator
object is used to create buffers
that can be written to the file system. This creates buffers as
files if they are larger than the specified limit. This ensures
that buffers of arbitrary large size can be created. All buffer
sizes under the limit are created using byte arrays allocated
on the executing VM heap. This ensures that optimal performance
is maintained for buffers of reasonable size.Constructor and Description |
---|
FileAllocator()
Constructor for the
FileAllocator object. |
FileAllocator(int limit)
Constructor for the
FileAllocator object. |
FileAllocator(java.lang.String prefix)
Constructor for the
FileAllocator object. |
FileAllocator(java.lang.String prefix,
int limit)
Constructor for the
FileAllocator object. |
Modifier and Type | Method and Description |
---|---|
Buffer |
allocate()
This will allocate a file buffer which will write data for the
buffer to a file.
|
Buffer |
allocate(int size)
This will allocate a file buffer which will write data for the
buffer to a file.
|
void |
close()
This method is used to close the allocator so that resources
that are occupied by the allocator can be freed.
|
public FileAllocator() throws java.io.IOException
FileAllocator
object. This is
used to create buffers in memory up to a threshold size. If a
buffer is required over the threshold size then the data is
written to a file, where it can be retrieved at a later point.java.io.IOException
public FileAllocator(int limit) throws java.io.IOException
FileAllocator
object. This is
used to create buffers in memory up to a threshold size. If a
buffer is required over the threshold size then the data is
written to a file, where it can be retrieved at a later point.limit
- this is the maximum size for a heap bufferjava.io.IOException
public FileAllocator(java.lang.String prefix) throws java.io.IOException
FileAllocator
object. This is
used to create buffers in memory up to a threshold size. If a
buffer is required over the threshold size then the data is
written to a file, where it can be retrieved at a later point.prefix
- this is the file prefix for the file buffersjava.io.IOException
public FileAllocator(java.lang.String prefix, int limit) throws java.io.IOException
FileAllocator
object. This is
used to create buffers in memory up to a threshold size. If a
buffer is required over the threshold size then the data is
written to a file, where it can be retrieved at a later point.prefix
- this is the file prefix for the file bufferslimit
- this is the maximum size for a heap bufferjava.io.IOException
public Buffer allocate() throws java.io.IOException
public Buffer allocate(int size) throws java.io.IOException
public void close() throws java.io.IOException