E - Type of Buffer that will be createdpublic interface ThreadLocalPool<E>
MemoryManager to create and modify Buffers| Modifier and Type | Method and Description |
|---|---|
E |
allocate(int size)
Creates a buffer with a given capacity and limit
|
boolean |
hasRemaining()
Whether there are elements between the current position and the end
|
boolean |
isLastAllocated(E oldBuffer)
Whether the last element in the buffer has been set
|
E |
reallocate(E oldBuffer,
int newSize)
Creates a new Buffer with a set size and assigns it the data that was held in the old one as long as the given size
is not smaller than the data held.
|
E |
reduceLastAllocated(E buffer)
Reduces the buffer to the last data allocated
|
boolean |
release(E underlyingBuffer)
deallocates the data in the buffer
|
int |
remaining()
Gets the number of elements between the current position and the limit
|
void |
reset(E pool)
Resets the Buffer to empty values and empties the pool
|
boolean |
wantReset(int size)
Checks if the size of the Buffer should be reset.
|
void reset(E pool)
pool - the buffer to resetE allocate(int size)
size - maximum number of elementsByteBuffer.allocate(int)E reallocate(E oldBuffer, int newSize)
oldBuffer - Old Buffer containing datanewSize - The size the new Buffer should be.boolean release(E underlyingBuffer)
underlyingBuffer - the buffer to releaseboolean isLastAllocated(E oldBuffer)
oldBuffer - the buffer to checkE reduceLastAllocated(E buffer)
buffer - boolean wantReset(int size)
size - the desired size of the buffer. If this is less than the current size ofthe buffer then this will return
falseint remaining()
boolean hasRemaining()
Copyright © 2017–2020 Oracle Corporation. All rights reserved.