public interface Allocator
extends java.io.Closeable
Allocator 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.| Modifier and Type | Method and Description |
|---|---|
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.
|
Buffer allocate() throws java.io.IOException
java.io.IOExceptionBuffer allocate(int size) throws java.io.IOException
size - this is the initial capacity the buffer should havejava.io.IOExceptionvoid close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOException