FlatBuffers
An open source project by FPL.
com.google.flatbuffers.FlatBufferBuilder.ByteBufferFactory Interface Reference

An interface that provides a user of the FlatBufferBuilder class the ability to specify the method in which the internal buffer gets allocated. More...

Inheritance diagram for com.google.flatbuffers.FlatBufferBuilder.ByteBufferFactory:
com.google.flatbuffers.FlatBufferBuilder.HeapByteBufferFactory

Detailed Description

An interface that provides a user of the FlatBufferBuilder class the ability to specify the method in which the internal buffer gets allocated.

This allows for alternatives to the default behavior, which is to allocate memory for a new byte-array backed ByteBuffer array inside the JVM.

The FlatBufferBuilder class contains the HeapByteBufferFactory class to preserve the default behavior in the event that the user does not provide their own implementation of this interface.

Public Member Functions

ByteBuffer newByteBuffer (int capacity)
 Create a ByteBuffer with a given capacity. More...
 
default void releaseByteBuffer (ByteBuffer bb)
 Release a ByteBuffer. More...
 

Member Function Documentation

◆ newByteBuffer()

ByteBuffer com.google.flatbuffers.FlatBufferBuilder.ByteBufferFactory.newByteBuffer ( int  capacity)

Create a ByteBuffer with a given capacity.

Parameters
capacityThe size of the ByteBuffer to allocate.
Returns
Returns the new ByteBuffer that was allocated.

Implemented in com.google.flatbuffers.FlatBufferBuilder.HeapByteBufferFactory.

◆ releaseByteBuffer()

default void com.google.flatbuffers.FlatBufferBuilder.ByteBufferFactory.releaseByteBuffer ( ByteBuffer  bb)
inline

Release a ByteBuffer.

Current FlatBufferBuilder released any reference to it, so it is safe to dispose the buffer or return it to a pool. It is not guaranteed that the buffer has been created with newByteBuffer(int).

Parameters
bbthe buffer to release

The documentation for this interface was generated from the following file: