-
- All Implemented Interfaces:
-
com.facebook.common.memory.PooledByteBuffer,java.io.Closeable,java.lang.AutoCloseable
@ThreadSafe() public class MemoryPooledByteBuffer implements PooledByteBufferAn implementation of PooledByteBuffer that uses (MemoryChunk) to store data
-
-
Constructor Summary
Constructors Constructor Description MemoryPooledByteBuffer(CloseableReference<MemoryChunk> bufRef, int size)
-
Method Summary
Modifier and Type Method Description synchronized intsize()Gets the size of the ByteBuffer if it is valid. synchronized byteread(int offset)synchronized intread(int offset, Array<byte> buffer, int bufferOffset, int length)synchronized longgetNativePtr()synchronized ByteBuffergetByteBuffer()synchronized booleanisClosed()synchronized voidclose()Closes this instance, and releases the underlying buffer to the pool. -
-
Constructor Detail
-
MemoryPooledByteBuffer
MemoryPooledByteBuffer(CloseableReference<MemoryChunk> bufRef, int size)
-
-
Method Detail
-
size
synchronized int size()
Gets the size of the ByteBuffer if it is valid. Otherwise, an exception is raised
-
read
synchronized byte read(int offset)
-
getNativePtr
synchronized long getNativePtr()
-
getByteBuffer
@Nullable() synchronized ByteBuffer getByteBuffer()
-
isClosed
synchronized boolean isClosed()
-
close
synchronized void close()
Closes this instance, and releases the underlying buffer to the pool. Once the ByteBuffer hasbeen closed, subsequent operations (especially
{@code getStream()}will fail. Note: It is notan error to close an already closed ByteBuffer
-
-
-
-