public class FileAllocator extends 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(String prefix)
Constructor for the
FileAllocator object. |
FileAllocator(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(long size)
This will allocate a file buffer which will write data for the
buffer to a file.
|
public FileAllocator()
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.public FileAllocator(int limit)
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 bufferpublic FileAllocator(String prefix)
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 bufferspublic FileAllocator(String prefix, int limit)
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 bufferpublic Buffer allocate() throws IOException
allocate
in interface Allocator
IOException
public Buffer allocate(long size) throws IOException
allocate
in interface Allocator
size
- this is the size of the buffer to be createdIOException
Copyright © 2018. All rights reserved.