Module com.github.akurilov.commons
Interface DirectMemUtil
-
public interface DirectMemUtilUtility methods to work with direct (off-heap) memory
-
-
Field Summary
Fields Modifier and Type Field Description static intREUSABLE_BUFF_SIZE_MAXstatic intREUSABLE_BUFF_SIZE_MINstatic java.lang.ThreadLocal<java.nio.MappedByteBuffer[]>REUSABLE_BUFFS
-
Method Summary
Static Methods Modifier and Type Method Description static java.nio.MappedByteBuffergetThreadLocalReusableBuff(long size)Selects the thread local direct byte buffer fitting the requested buffer size.
-
-
-
Field Detail
-
REUSABLE_BUFF_SIZE_MIN
static final int REUSABLE_BUFF_SIZE_MIN
- See Also:
- Constant Field Values
-
REUSABLE_BUFF_SIZE_MAX
static final int REUSABLE_BUFF_SIZE_MAX
- See Also:
- Constant Field Values
-
REUSABLE_BUFFS
static final java.lang.ThreadLocal<java.nio.MappedByteBuffer[]> REUSABLE_BUFFS
-
-
Method Detail
-
getThreadLocalReusableBuff
static java.nio.MappedByteBuffer getThreadLocalReusableBuff(long size) throws java.lang.IllegalArgumentExceptionSelects the thread local direct byte buffer fitting the requested buffer size. Useful for I/O.- Parameters:
size- the requested buffer size- Returns:
- the buffer which size may be in the range of
REUSABLE_BUFF_SIZE_MINandREUSABLE_BUFF_SIZE_MAX - Throws:
java.lang.IllegalArgumentException- if the requested size is less than 0
-
-