Class FlatBuffers


  • public class FlatBuffers
    extends Object
    Utility class to create and release the internal byte buffers of a FlatBufferBuilder.

    In order to either release or return to the cache the used buffers as soon as possible, use newBuilder(int) and release(FlatBufferBuilder) as soon as possible, instead of expecting the GC to do it.

    Implementation Note:
    Currently, the returned builders use a FlatBufferBuilder.ByteBufferFactory that uses GeoTools NIOUtilities cached buffers. This means that the buffers will be reused, but also that they'll be direct or heap buffers depending on NIOUtilities.isDirectBuffersEnabled(), hence the importance of calling release(FlatBufferBuilder) as soon as the builder is to be disposed, to the GeoTools utility can take care of cleaning up the direct buffers when needed.
    • Constructor Detail

      • FlatBuffers

        public FlatBuffers()
    • Method Detail

      • newBuilder

        public static com.google.flatbuffers.FlatBufferBuilder newBuilder​(int minimumCapacity)
      • release

        public static void release​(com.google.flatbuffers.FlatBufferBuilder builder)