GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
com.jogamp.common.nio.CachedBufferFactory Class Reference

Buffer factory attempting to reduce buffer creation overhead. More...

Collaboration diagram for com.jogamp.common.nio.CachedBufferFactory:

Public Member Functions

boolean isFixed ()
 Returns true only if this factory does not allow to allocate more buffers as limited by the initial size. More...
 
int getAllocationSize ()
 Returns the allocation size used to create new internal buffers. More...
 
void destroy ()
 
ByteBuffer newDirectByteBuffer (final int size)
 
ByteBuffer newDirectByteBuffer (final byte[] values, final int offset, final int lenght)
 
ByteBuffer newDirectByteBuffer (final byte[] values, final int offset)
 
ByteBuffer newDirectByteBuffer (final byte[] values)
 
DoubleBuffer newDirectDoubleBuffer (final int numElements)
 
DoubleBuffer newDirectDoubleBuffer (final double[] values, final int offset, final int lenght)
 
DoubleBuffer newDirectDoubleBuffer (final double[] values, final int offset)
 
DoubleBuffer newDirectDoubleBuffer (final double[] values)
 
FloatBuffer newDirectFloatBuffer (final int numElements)
 
FloatBuffer newDirectFloatBuffer (final float[] values, final int offset, final int lenght)
 
FloatBuffer newDirectFloatBuffer (final float[] values, final int offset)
 
FloatBuffer newDirectFloatBuffer (final float[] values)
 
IntBuffer newDirectIntBuffer (final int numElements)
 
IntBuffer newDirectIntBuffer (final int[] values, final int offset, final int lenght)
 
IntBuffer newDirectIntBuffer (final int[] values, final int offset)
 
IntBuffer newDirectIntBuffer (final int[] values)
 
LongBuffer newDirectLongBuffer (final int numElements)
 
LongBuffer newDirectLongBuffer (final long[] values, final int offset, final int lenght)
 
LongBuffer newDirectLongBuffer (final long[] values, final int offset)
 
LongBuffer newDirectLongBuffer (final long[] values)
 
ShortBuffer newDirectShortBuffer (final int numElements)
 
ShortBuffer newDirectShortBuffer (final short[] values, final int offset, final int lenght)
 
ShortBuffer newDirectShortBuffer (final short[] values, final int offset)
 
ShortBuffer newDirectShortBuffer (final short[] values)
 
CharBuffer newDirectCharBuffer (final int numElements)
 
CharBuffer newDirectCharBuffer (final char[] values, final int offset, final int lenght)
 
CharBuffer newDirectCharBuffer (final char[] values, final int offset)
 
CharBuffer newDirectCharBuffer (final char[] values)
 
boolean equals (final Object obj)
 
String toString ()
 

Static Public Member Functions

static CachedBufferFactory create ()
 Creates a factory with initial size and allocation size set to DEFAULT_ALLOCATION_SIZE. More...
 
static CachedBufferFactory create (final int initialSize)
 Creates a factory with the specified initial size. More...
 
static CachedBufferFactory create (final int initialSize, final boolean fixed)
 Creates a factory with the specified initial size. More...
 
static CachedBufferFactory create (final int initialSize, final int allocationSize)
 Creates a factory with the specified initial size and allocation size. More...
 
static CachedBufferFactory createSynchronized ()
 Synchronized version of create(). More...
 
static CachedBufferFactory createSynchronized (final int initialSize)
 Synchronized version of create(int). More...
 
static CachedBufferFactory createSynchronized (final int initialSize, final boolean fixed)
 Synchronized version of create(int, boolean). More...
 
static CachedBufferFactory createSynchronized (final int initialSize, final int allocationSize)
 Synchronized version of create(int, int). More...
 

Static Public Attributes

static final int DEFAULT_ALLOCATION_SIZE = 1024 * 1024
 default size for internal buffer allocation. More...
 

Detailed Description

Buffer factory attempting to reduce buffer creation overhead.

Direct ByteBuffers must be page aligned which increases creation overhead of small buffers significantly. This factory can be used as fixed size static or or dynamic allocating factory. The initial size and allocation size is configurable.

Fixed size factories may be used in systems with hard realtime requirements and/or predictable memory usage.

concurrency info:

  • all create methods are threadsafe
  • factories created with create(...) are not threadsafe
  • factories created with createSynchronized(...) are threadsafe
Author
Michael Bien

Definition at line 64 of file CachedBufferFactory.java.

Member Function Documentation

◆ create() [1/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.create ( )
static

Creates a factory with initial size and allocation size set to DEFAULT_ALLOCATION_SIZE.

Definition at line 88 of file CachedBufferFactory.java.

Here is the caller graph for this function:

◆ create() [2/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.create ( final int  initialSize)
static

Creates a factory with the specified initial size.

The allocation size is set to DEFAULT_ALLOCATION_SIZE.

Definition at line 96 of file CachedBufferFactory.java.

◆ create() [3/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.create ( final int  initialSize,
final boolean  fixed 
)
static

Creates a factory with the specified initial size.

The allocation size is set to DEFAULT_ALLOCATION_SIZE.

Parameters
fixedCreates a fixed size factory which will handle overflows (initial size) with RuntimeExceptions.

Definition at line 106 of file CachedBufferFactory.java.

◆ create() [4/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.create ( final int  initialSize,
final int  allocationSize 
)
static

Creates a factory with the specified initial size and allocation size.

Definition at line 113 of file CachedBufferFactory.java.

◆ createSynchronized() [1/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.createSynchronized ( )
static

Synchronized version of create().

Definition at line 121 of file CachedBufferFactory.java.

Here is the caller graph for this function:

◆ createSynchronized() [2/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.createSynchronized ( final int  initialSize)
static

Synchronized version of create(int).

Definition at line 128 of file CachedBufferFactory.java.

◆ createSynchronized() [3/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.createSynchronized ( final int  initialSize,
final boolean  fixed 
)
static

Synchronized version of create(int, boolean).

Definition at line 135 of file CachedBufferFactory.java.

◆ createSynchronized() [4/4]

static CachedBufferFactory com.jogamp.common.nio.CachedBufferFactory.createSynchronized ( final int  initialSize,
final int  allocationSize 
)
static

Synchronized version of create(int, int).

Definition at line 142 of file CachedBufferFactory.java.

◆ destroy()

void com.jogamp.common.nio.CachedBufferFactory.destroy ( )

Definition at line 171 of file CachedBufferFactory.java.

◆ equals()

boolean com.jogamp.common.nio.CachedBufferFactory.equals ( final Object  obj)

Definition at line 308 of file CachedBufferFactory.java.

◆ getAllocationSize()

int com.jogamp.common.nio.CachedBufferFactory.getAllocationSize ( )

Returns the allocation size used to create new internal buffers.

0 means that the buffer will not grows, see isFixed().

Definition at line 158 of file CachedBufferFactory.java.

Here is the caller graph for this function:

◆ isFixed()

boolean com.jogamp.common.nio.CachedBufferFactory.isFixed ( )

Returns true only if this factory does not allow to allocate more buffers as limited by the initial size.

Definition at line 150 of file CachedBufferFactory.java.

Here is the caller graph for this function:

◆ newDirectByteBuffer() [1/4]

ByteBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectByteBuffer ( final byte[]  values)

Definition at line 207 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectByteBuffer() [2/4]

ByteBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectByteBuffer ( final byte[]  values,
final int  offset 
)

Definition at line 203 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectByteBuffer() [3/4]

ByteBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectByteBuffer ( final byte[]  values,
final int  offset,
final int  lenght 
)

Definition at line 199 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectByteBuffer() [4/4]

ByteBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectByteBuffer ( final int  size)

Definition at line 177 of file CachedBufferFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDirectCharBuffer() [1/4]

CharBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectCharBuffer ( final char[]  values)

Definition at line 303 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectCharBuffer() [2/4]

CharBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectCharBuffer ( final char[]  values,
final int  offset 
)

Definition at line 299 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectCharBuffer() [3/4]

CharBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectCharBuffer ( final char[]  values,
final int  offset,
final int  lenght 
)

Definition at line 295 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectCharBuffer() [4/4]

CharBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectCharBuffer ( final int  numElements)

Definition at line 291 of file CachedBufferFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDirectDoubleBuffer() [1/4]

DoubleBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectDoubleBuffer ( final double[]  values)

Definition at line 223 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectDoubleBuffer() [2/4]

DoubleBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectDoubleBuffer ( final double[]  values,
final int  offset 
)

Definition at line 219 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectDoubleBuffer() [3/4]

DoubleBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectDoubleBuffer ( final double[]  values,
final int  offset,
final int  lenght 
)

Definition at line 215 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectDoubleBuffer() [4/4]

DoubleBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectDoubleBuffer ( final int  numElements)

Definition at line 211 of file CachedBufferFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDirectFloatBuffer() [1/4]

FloatBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectFloatBuffer ( final float[]  values)

Definition at line 239 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectFloatBuffer() [2/4]

FloatBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectFloatBuffer ( final float[]  values,
final int  offset 
)

Definition at line 235 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectFloatBuffer() [3/4]

FloatBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectFloatBuffer ( final float[]  values,
final int  offset,
final int  lenght 
)

Definition at line 231 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectFloatBuffer() [4/4]

FloatBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectFloatBuffer ( final int  numElements)

Definition at line 227 of file CachedBufferFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDirectIntBuffer() [1/4]

IntBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectIntBuffer ( final int  numElements)

Definition at line 243 of file CachedBufferFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDirectIntBuffer() [2/4]

IntBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectIntBuffer ( final int[]  values)

Definition at line 255 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectIntBuffer() [3/4]

IntBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectIntBuffer ( final int[]  values,
final int  offset 
)

Definition at line 251 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectIntBuffer() [4/4]

IntBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectIntBuffer ( final int[]  values,
final int  offset,
final int  lenght 
)

Definition at line 247 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectLongBuffer() [1/4]

LongBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectLongBuffer ( final int  numElements)

Definition at line 259 of file CachedBufferFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDirectLongBuffer() [2/4]

LongBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectLongBuffer ( final long[]  values)

Definition at line 271 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectLongBuffer() [3/4]

LongBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectLongBuffer ( final long[]  values,
final int  offset 
)

Definition at line 267 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectLongBuffer() [4/4]

LongBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectLongBuffer ( final long[]  values,
final int  offset,
final int  lenght 
)

Definition at line 263 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectShortBuffer() [1/4]

ShortBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectShortBuffer ( final int  numElements)

Definition at line 275 of file CachedBufferFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDirectShortBuffer() [2/4]

ShortBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectShortBuffer ( final short[]  values)

Definition at line 287 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectShortBuffer() [3/4]

ShortBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectShortBuffer ( final short[]  values,
final int  offset 
)

Definition at line 283 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ newDirectShortBuffer() [4/4]

ShortBuffer com.jogamp.common.nio.CachedBufferFactory.newDirectShortBuffer ( final short[]  values,
final int  offset,
final int  lenght 
)

Definition at line 279 of file CachedBufferFactory.java.

Here is the call graph for this function:

◆ toString()

String com.jogamp.common.nio.CachedBufferFactory.toString ( )

Definition at line 326 of file CachedBufferFactory.java.

Here is the call graph for this function:

Member Data Documentation

◆ DEFAULT_ALLOCATION_SIZE

final int com.jogamp.common.nio.CachedBufferFactory.DEFAULT_ALLOCATION_SIZE = 1024 * 1024
static

default size for internal buffer allocation.

Definition at line 69 of file CachedBufferFactory.java.


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