Package 

Class MemoryPooledByteBuffer

  • All Implemented Interfaces:
    com.facebook.common.memory.PooledByteBuffer , java.io.Closeable , java.lang.AutoCloseable

    @ThreadSafe() 
    public class MemoryPooledByteBuffer
     implements PooledByteBuffer
                        

    An implementation of PooledByteBuffer that uses (MemoryChunk) to store data

    • Method Summary

      Modifier and Type Method Description
      synchronized int size() Gets the size of the ByteBuffer if it is valid.
      synchronized byte read(int offset)
      synchronized int read(int offset, Array<byte> buffer, int bufferOffset, int length)
      synchronized long getNativePtr()
      synchronized ByteBuffer getByteBuffer()
      synchronized boolean isClosed()
      synchronized void close() Closes this instance, and releases the underlying buffer to the pool.
      • Methods inherited from class com.facebook.common.memory.PooledByteBuffer

        close, getByteBuffer, getNativePtr, isClosed, read, read, size
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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)
      • read

         synchronized int read(int offset, Array<byte> buffer, int bufferOffset, int length)
      • 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