Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.emory.mathcs.util.allocator
Interface Allocator  view Allocator download Allocator.java

All Known Implementing Classes:
DirectAllocator, PoolingAllocator

public interface Allocator

Abstraction of memory manager. Useful for I/O processing when direct buffer management is required, e.g. if one wants to control maximum memory usage by I/O buffers. Example application is in util.io.BufferedPipe. Concrete implementations of this interface may implement various allocation policies.

Version:
1.0

Nested Class Summary
static class Allocator.Buffer
          Represents the data buffer returned to the application as a result of allocate() request.
 
Method Summary
 Allocator.Buffer allocate(int size, boolean clear, long timeout)
          Allocate a buffer with specified size.
 

Method Detail

allocate

public Allocator.Buffer allocate(int size,
                                 boolean clear,
                                 long timeout)
                          throws java.lang.InterruptedException
Allocate a buffer with specified size. The operation can block if memory limits are exceeded. The timeout value greater than 0 indicates the timeout, the value of 0 will cause immediate return of null if the buffer was not available, and value less than zero will cause to wait for buffer inidefinitely. The clear parameter indicates that the buffer should be zeroed out. Since buffers may be recycled, the buffer returned may contain random garbage if this value is false. If it is set to true, the [0..size] region of the array within the buffer is filled with zeros. This method may return a buffer containing an array larger than requested.