Interface Allocator
-
- All Known Implementing Classes:
ArrayAllocator
,BufferAllocator
,FileAllocator
,FilterAllocator
public interface Allocator
TheAllocator
interface is used to describe a resource that can allocate a buffer. This is used so that memory allocation can be implemented as a strategy allowing many different sources of memory. Typically memory will be allocated as an array of bytes but can be a mapped region of shared memory or a file.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Buffer
allocate()
This method is used to allocate a default buffer.Buffer
allocate(long size)
This method is used to allocate a default buffer.
-
-
-
Method Detail
-
allocate
Buffer allocate() throws java.io.IOException
This method is used to allocate a default buffer. Typically this will allocate a buffer of predetermined size, allowing it to grow to an upper limit to accommodate extra data. If the buffer can not be allocated for some reason this throws an exception.- Returns:
- this returns an allocated buffer with a default size
- Throws:
java.io.IOException
-
allocate
Buffer allocate(long size) throws java.io.IOException
This method is used to allocate a default buffer. This is used to allocate a buffer of the specified size, allowing it to grow to an upper limit to accommodate extra data. If the buffer can not be allocated for some reason this throws an exception.- Parameters:
size
- this is the initial capacity the buffer should have- Returns:
- this returns an allocated buffer with a specified size
- Throws:
java.io.IOException
-
-