java.lang.Object | |
↳ | com.facebook.imagepipeline.memory.MemoryPooledByteBuffer |
An implementation of PooledByteBuffer
that uses (MemoryChunk
) to store data
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MemoryPooledByteBuffer(CloseableReference<MemoryChunk> bufRef, int size) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized void |
close()
Closes this instance, and releases the underlying buffer to the pool.
| ||||||||||
synchronized ByteBuffer |
getByteBuffer()
Gets the underlying ByteBuffer backing this buffer if present, else null.
| ||||||||||
synchronized long |
getNativePtr()
Gets the pointer to native memory backing this buffer if present
| ||||||||||
synchronized boolean |
isClosed()
Check if this instance has already been closed
| ||||||||||
synchronized int |
read(int offset, byte[] buffer, int bufferOffset, int length)
Read consecutive bytes.
| ||||||||||
synchronized byte |
read(int offset)
Read byte at given offset
| ||||||||||
synchronized int |
size()
Gets the size of the ByteBuffer if it is valid.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.facebook.common.memory.PooledByteBuffer
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.lang.AutoCloseable
|
Closes this instance, and releases the underlying buffer to the pool. Once the ByteBuffer has
been closed, subsequent operations (especially getStream()
will fail. Note: It is not
an error to close an already closed ByteBuffer
Gets the underlying ByteBuffer backing this buffer if present, else null.
Gets the pointer to native memory backing this buffer if present
UnsupportedOperationException |
---|
Check if this instance has already been closed
Read consecutive bytes.
offset | the position in the PooledByteBuffer of the first byte to read |
---|---|
buffer | the byte array where read bytes will be copied to |
bufferOffset | the position within the buffer of the first copied byte |
length | number of bytes to copy |
Read byte at given offset
Gets the size of the ByteBuffer if it is valid. Otherwise, an exception is raised
ClosedException} |