Class MemoryStack
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.MemoryStack
-
- All Implemented Interfaces:
java.lang.AutoCloseable,Pointer
public class MemoryStack extends Pointer.Default implements java.lang.AutoCloseable
An off-heap memory stack.This class should be used in a thread-local manner for stack allocations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer
Pointer.Default
-
-
Field Summary
-
Fields inherited from interface org.lwjgl.system.Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBufferASCII(java.lang.CharSequence text)Encodes the specified text on the stack using ASCII encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.java.nio.ByteBufferASCII(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using ASCII encoding and returns a ByteBuffer that points to the encoded text.java.nio.ByteBufferASCIISafe(java.lang.CharSequence text)java.nio.ByteBufferASCIISafe(java.lang.CharSequence text, boolean nullTerminated)java.nio.ByteBufferbytes(byte x)Single value version ofmalloc(int, int).java.nio.ByteBufferbytes(byte... values)Vararg version ofmalloc(int, int).java.nio.ByteBufferbytes(byte x, byte y)Two value version ofmalloc(int, int).java.nio.ByteBufferbytes(byte x, byte y, byte z)Three value version ofmalloc(int, int).java.nio.ByteBufferbytes(byte x, byte y, byte z, byte w)Four value version ofmalloc(int, int).java.nio.ByteBuffercalloc(int size)Calloc version ofmalloc(int).java.nio.ByteBuffercalloc(int alignment, int size)Calloc version ofmalloc(int, int).CLongBuffercallocCLong(int size)CLong version ofcalloc(int).java.nio.DoubleBuffercallocDouble(int size)Double version ofcalloc(int).java.nio.FloatBuffercallocFloat(int size)Float version ofcalloc(int).java.nio.IntBuffercallocInt(int size)Int version ofcalloc(int).java.nio.LongBuffercallocLong(int size)Long version ofcalloc(int).PointerBuffercallocPointer(int size)Pointer version ofcalloc(int).java.nio.ShortBuffercallocShort(int size)Short version ofcalloc(int).CLongBufferclongs(long x)Single value version ofmallocCLong(int).CLongBufferclongs(long... values)Vararg version ofmallocCLong(int).CLongBufferclongs(long x, long y)Two value version ofmallocCLong(int).CLongBufferclongs(long x, long y, long z)Three value version ofmallocCLong(int).CLongBufferclongs(long x, long y, long z, long w)Four value version ofmallocCLong(int).voidclose()Callspop()on thisMemoryStack.static MemoryStackcreate()Creates a newMemoryStackwith the default size.static MemoryStackcreate(int capacity)Creates a newMemoryStackwith the specified size.static MemoryStackcreate(java.nio.ByteBuffer buffer)Creates a newMemoryStackbacked by the specified memory buffer.java.nio.DoubleBufferdoubles(double x)Single value version ofmallocDouble(int).java.nio.DoubleBufferdoubles(double... values)Vararg version ofmallocDouble(int).java.nio.DoubleBufferdoubles(double x, double y)Two value version ofmallocDouble(int).java.nio.DoubleBufferdoubles(double x, double y, double z)Three value version ofmallocDouble(int).java.nio.DoubleBufferdoubles(double x, double y, double z, double w)Four value version ofmallocDouble(int).java.nio.FloatBufferfloats(float x)Single value version ofmallocFloat(int).java.nio.FloatBufferfloats(float... values)Vararg version ofmallocFloat(int).java.nio.FloatBufferfloats(float x, float y)Two value version ofmallocFloat(int).java.nio.FloatBufferfloats(float x, float y, float z)Three value version ofmallocFloat(int).java.nio.FloatBufferfloats(float x, float y, float z, float w)Four value version ofmallocFloat(int).longgetAddress()Returns the address of the backing off-heap memory.intgetFrameIndex()Returns the current frame index.intgetPointer()Returns the current stack pointer.longgetPointerAddress()Returns the memory address at the current stack pointer.intgetSize()Returns the size of the backing off-heap memory.java.nio.IntBufferints(int x)Single value version ofmallocInt(int).java.nio.IntBufferints(int... values)Vararg version ofmallocInt(int).java.nio.IntBufferints(int x, int y)Two value version ofmallocInt(int).java.nio.IntBufferints(int x, int y, int z)Three value version ofmallocInt(int).java.nio.IntBufferints(int x, int y, int z, int w)Four value version ofmallocInt(int).java.nio.LongBufferlongs(long x)Single value version ofmallocLong(int).java.nio.LongBufferlongs(long... more)Vararg version ofmallocLong(int).java.nio.LongBufferlongs(long x, long y)Two value version ofmallocLong(int).java.nio.LongBufferlongs(long x, long y, long z)Three value version ofmallocLong(int).java.nio.LongBufferlongs(long x, long y, long z, long w)Four value version ofmallocLong(int).java.nio.ByteBuffermalloc(int size)Allocates aByteBufferon the stack.java.nio.ByteBuffermalloc(int alignment, int size)Allocates an alignedByteBufferon the stack.CLongBuffermallocCLong(int size)CLong version ofmalloc(int).java.nio.DoubleBuffermallocDouble(int size)Double version ofmalloc(int).java.nio.FloatBuffermallocFloat(int size)Float version ofmalloc(int).java.nio.IntBuffermallocInt(int size)Int version ofmalloc(int).java.nio.LongBuffermallocLong(int size)Long version ofmalloc(int).PointerBuffermallocPointer(int size)Pointer version ofmalloc(int).java.nio.ShortBuffermallocShort(int size)Short version ofmalloc(int).intnASCII(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using ASCII encoding and returns the encoded text length, in bytes.intnASCIISafe(java.lang.CharSequence text, boolean nullTerminated)longncalloc(int alignment, int num, int size)Allocates a block of memory on the stack for an array ofnumelements, each of themsizebytes long, and initializes all its bits to zero.static MemoryStackncreate(long address, int size)Creates a newMemoryStackbacked by the specified memory region.longnmalloc(int size)Callsnmalloc(int, int)withalignmentequal to 1.longnmalloc(int alignment, int size)Allocates a block ofsizebytes of memory on the stack.static longnstackCalloc(int alignment, int num, int size)Thread-local version ofncalloc(int, int, int).static longnstackMalloc(int size)Thread-local version ofnmalloc(int).static longnstackMalloc(int alignment, int size)Thread-local version ofnmalloc(int, int).intnUTF16(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF16 encoding and returns the encoded text length, in bytes.intnUTF16Safe(java.lang.CharSequence text, boolean nullTerminated)intnUTF8(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF8 encoding and returns the encoded text length, in bytes.intnUTF8Safe(java.lang.CharSequence text, boolean nullTerminated)PointerBufferpointers(long x)Single value version ofmallocPointer(int).PointerBufferpointers(long... values)Vararg version ofmallocPointer(int).PointerBufferpointers(long x, long y)Two value version ofmallocPointer(int).PointerBufferpointers(long x, long y, long z)Three value version ofmallocPointer(int).PointerBufferpointers(long x, long y, long z, long w)Four value version ofmallocPointer(int).PointerBufferpointers(java.nio.Buffer x)Single value version ofmallocPointer(int).PointerBufferpointers(java.nio.Buffer... values)Vararg version ofmallocPointer(int).PointerBufferpointers(java.nio.Buffer x, java.nio.Buffer y)Two value version ofmallocPointer(int).PointerBufferpointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z)Three value version ofmallocPointer(int).PointerBufferpointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z, java.nio.Buffer w)Four value version ofmallocPointer(int).PointerBufferpointers(Pointer x)Single value version ofmallocPointer(int).PointerBufferpointers(Pointer... values)Vararg version ofmallocPointer(int).PointerBufferpointers(Pointer x, Pointer y)Two value version ofmallocPointer(int).PointerBufferpointers(Pointer x, Pointer y, Pointer z)Three value version ofmallocPointer(int).PointerBufferpointers(Pointer x, Pointer y, Pointer z, Pointer w)Four value version ofmallocPointer(int).MemoryStackpop()Pops the current stack frame and moves the stack pointer to the end of the previous stack frame.MemoryStackpush()Stores the current stack pointer and pushes a new frame to the stack.voidsetPointer(int pointer)Sets the current stack pointer.java.nio.ShortBuffershorts(short x)Single value version ofmallocShort(int).java.nio.ShortBuffershorts(short... values)Vararg version ofmallocShort(int).java.nio.ShortBuffershorts(short x, short y)Two value version ofmallocShort(int).java.nio.ShortBuffershorts(short x, short y, short z)Three value version ofmallocShort(int).java.nio.ShortBuffershorts(short x, short y, short z, short w)Four value version ofmallocShort(int).static java.nio.ByteBufferstackASCII(java.lang.CharSequence text)Thread-local version ofASCII(CharSequence).static java.nio.ByteBufferstackASCII(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofASCII(CharSequence, boolean).static java.nio.ByteBufferstackASCIISafe(java.lang.CharSequence text)Thread-local version ofASCII(CharSequence).static java.nio.ByteBufferstackASCIISafe(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofASCII(CharSequence, boolean).static java.nio.ByteBufferstackBytes(byte x)Thread-local version ofbytes(byte).static java.nio.ByteBufferstackBytes(byte... values)Thread-local version ofbytes(byte...).static java.nio.ByteBufferstackBytes(byte x, byte y)Thread-local version ofbytes(byte, byte).static java.nio.ByteBufferstackBytes(byte x, byte y, byte z)Thread-local version ofbytes(byte, byte, byte).static java.nio.ByteBufferstackBytes(byte x, byte y, byte z, byte w)Thread-local version ofbytes(byte, byte, byte, byte).static java.nio.ByteBufferstackCalloc(int size)Thread-local version ofcalloc(int, int).static CLongBufferstackCallocCLong(int size)Thread-local version ofcallocCLong(int).static java.nio.DoubleBufferstackCallocDouble(int size)Thread-local version ofcallocDouble(int).static java.nio.FloatBufferstackCallocFloat(int size)Thread-local version ofcallocFloat(int).static java.nio.IntBufferstackCallocInt(int size)Thread-local version ofcallocInt(int).static java.nio.LongBufferstackCallocLong(int size)Thread-local version ofcallocLong(int).static PointerBufferstackCallocPointer(int size)Thread-local version ofcallocPointer(int).static java.nio.ShortBufferstackCallocShort(int size)Thread-local version ofcallocShort(int).static CLongBufferstackCLongs(long x)Thread-local version oflongs(long).static CLongBufferstackCLongs(long... values)Thread-local version oflongs(long...).static CLongBufferstackCLongs(long x, long y)Thread-local version oflongs(long, long).static CLongBufferstackCLongs(long x, long y, long z)Thread-local version oflongs(long, long, long).static CLongBufferstackCLongs(long x, long y, long z, long w)Thread-local version oflongs(long, long, long, long).static java.nio.DoubleBufferstackDoubles(double x)Thread-local version ofdoubles(double).static java.nio.DoubleBufferstackDoubles(double... values)Thread-local version ofdoubles(double...).static java.nio.DoubleBufferstackDoubles(double x, double y)Thread-local version ofdoubles(double, double).static java.nio.DoubleBufferstackDoubles(double x, double y, double z)Thread-local version ofdoubles(double, double, double).static java.nio.DoubleBufferstackDoubles(double x, double y, double z, double w)Thread-local version ofdoubles(double, double, double, double).static java.nio.FloatBufferstackFloats(float x)Thread-local version offloats(float).static java.nio.FloatBufferstackFloats(float... values)Thread-local version offloats(float...).static java.nio.FloatBufferstackFloats(float x, float y)Thread-local version offloats(float, float).static java.nio.FloatBufferstackFloats(float x, float y, float z)Thread-local version offloats(float, float, float).static java.nio.FloatBufferstackFloats(float x, float y, float z, float w)Thread-local version offloats(float, float, float, float).static MemoryStackstackGet()Returns the stack of the current thread.static java.nio.IntBufferstackInts(int x)Thread-local version ofints(int).static java.nio.IntBufferstackInts(int... values)Thread-local version ofints(int...).static java.nio.IntBufferstackInts(int x, int y)Thread-local version ofints(int, int).static java.nio.IntBufferstackInts(int x, int y, int z)Thread-local version ofints(int, int, int).static java.nio.IntBufferstackInts(int x, int y, int z, int w)Thread-local version ofints(int, int, int, int).static java.nio.LongBufferstackLongs(long x)Thread-local version oflongs(long).static java.nio.LongBufferstackLongs(long... values)Thread-local version oflongs(long...).static java.nio.LongBufferstackLongs(long x, long y)Thread-local version oflongs(long, long).static java.nio.LongBufferstackLongs(long x, long y, long z)Thread-local version oflongs(long, long, long).static java.nio.LongBufferstackLongs(long x, long y, long z, long w)Thread-local version oflongs(long, long, long, long).static java.nio.ByteBufferstackMalloc(int size)Thread-local version ofmalloc(int, int).static CLongBufferstackMallocCLong(int size)Thread-local version ofmallocCLong(int).static java.nio.DoubleBufferstackMallocDouble(int size)Thread-local version ofmallocDouble(int).static java.nio.FloatBufferstackMallocFloat(int size)Thread-local version ofmallocFloat(int).static java.nio.IntBufferstackMallocInt(int size)Thread-local version ofmallocInt(int).static java.nio.LongBufferstackMallocLong(int size)Thread-local version ofmallocLong(int).static PointerBufferstackMallocPointer(int size)Thread-local version ofmallocPointer(int).static java.nio.ShortBufferstackMallocShort(int size)Thread-local version ofmallocShort(int).static PointerBufferstackPointers(long x)Thread-local version ofpointers(long).static PointerBufferstackPointers(long... values)Thread-local version ofpointers(long...).static PointerBufferstackPointers(long x, long y)Thread-local version ofpointers(long, long).static PointerBufferstackPointers(long x, long y, long z)Thread-local version ofpointers(long, long, long).static PointerBufferstackPointers(long x, long y, long z, long w)Thread-local version ofpointers(long, long, long, long).static PointerBufferstackPointers(Pointer x)Thread-local version ofpointers(Pointer).static PointerBufferstackPointers(Pointer... values)Thread-local version ofpointers(Pointer...).static PointerBufferstackPointers(Pointer x, Pointer y)Thread-local version ofpointers(Pointer, Pointer).static PointerBufferstackPointers(Pointer x, Pointer y, Pointer z)Thread-local version ofpointers(Pointer, Pointer, Pointer).static PointerBufferstackPointers(Pointer x, Pointer y, Pointer z, Pointer w)Thread-local version ofpointers(Pointer, Pointer, Pointer, Pointer).static MemoryStackstackPop()Callspop()on the stack of the current thread.static MemoryStackstackPush()Callspush()on the stack of the current thread.static java.nio.ShortBufferstackShorts(short x)Thread-local version ofshorts(short).static java.nio.ShortBufferstackShorts(short... values)Thread-local version ofshorts(short...).static java.nio.ShortBufferstackShorts(short x, short y)Thread-local version ofshorts(short, short).static java.nio.ShortBufferstackShorts(short x, short y, short z)Thread-local version ofshorts(short, short, short).static java.nio.ShortBufferstackShorts(short x, short y, short z, short w)Thread-local version ofshorts(short, short, short, short).static java.nio.ByteBufferstackUTF16(java.lang.CharSequence text)Thread-local version ofUTF16(CharSequence).static java.nio.ByteBufferstackUTF16(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF16(CharSequence, boolean).static java.nio.ByteBufferstackUTF16Safe(java.lang.CharSequence text)Thread-local version ofUTF16(CharSequence).static java.nio.ByteBufferstackUTF16Safe(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF16(CharSequence, boolean).static java.nio.ByteBufferstackUTF8(java.lang.CharSequence text)Thread-local version ofUTF8(CharSequence).static java.nio.ByteBufferstackUTF8(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF8(CharSequence, boolean).static java.nio.ByteBufferstackUTF8Safe(java.lang.CharSequence text)Thread-local version ofUTF8(CharSequence).static java.nio.ByteBufferstackUTF8Safe(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF8(CharSequence, boolean).java.nio.ByteBufferUTF16(java.lang.CharSequence text)Encodes the specified text on the stack using UTF16 encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.java.nio.ByteBufferUTF16(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF16 encoding and returns a ByteBuffer that points to the encoded text.java.nio.ByteBufferUTF16Safe(java.lang.CharSequence text)java.nio.ByteBufferUTF16Safe(java.lang.CharSequence text, boolean nullTerminated)java.nio.ByteBufferUTF8(java.lang.CharSequence text)Encodes the specified text on the stack using UTF8 encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.java.nio.ByteBufferUTF8(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF8 encoding and returns a ByteBuffer that points to the encoded text.java.nio.ByteBufferUTF8Safe(java.lang.CharSequence text)java.nio.ByteBufferUTF8Safe(java.lang.CharSequence text, boolean nullTerminated)-
Methods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toString
-
-
-
-
Method Detail
-
create
public static MemoryStack create()
Creates a newMemoryStackwith the default size.In the initial state, there is no active stack frame. The
push()method must be used before any allocations.
-
create
public static MemoryStack create(int capacity)
Creates a newMemoryStackwith the specified size.In the initial state, there is no active stack frame. The
push()method must be used before any allocations.- Parameters:
capacity- the maximum number of bytes that may be allocated on the stack
-
create
public static MemoryStack create(java.nio.ByteBuffer buffer)
Creates a newMemoryStackbacked by the specified memory buffer.In the initial state, there is no active stack frame. The
push()method must be used before any allocations.- Parameters:
buffer- the backing memory buffer
-
ncreate
public static MemoryStack ncreate(long address, int size)
Creates a newMemoryStackbacked by the specified memory region.In the initial state, there is no active stack frame. The
push()method must be used before any allocations.- Parameters:
address- the backing memory addresssize- the backing memory size
-
push
public MemoryStack push()
Stores the current stack pointer and pushes a new frame to the stack.This method should be called when entering a method, before doing any stack allocations. When exiting a method, call the
pop()method to restore the previous stack frame.Pairs of push/pop calls may be nested. Care must be taken to:
- match every push with a pop
- not call pop before push has been called at least once
- not nest push calls to more than the maximum supported depth
- Returns:
- this stack
-
pop
public MemoryStack pop()
Pops the current stack frame and moves the stack pointer to the end of the previous stack frame.- Returns:
- this stack
-
close
public void close()
Callspop()on thisMemoryStack.This method should not be used directly. It is called automatically when the
MemoryStackis used as a resource in a try-with-resources statement.- Specified by:
closein interfacejava.lang.AutoCloseable
-
getAddress
public long getAddress()
Returns the address of the backing off-heap memory.The stack grows "downwards", so the bottom of the stack is at
address + size, while the top is ataddress.
-
getSize
public int getSize()
Returns the size of the backing off-heap memory.This is the maximum number of bytes that may be allocated on the stack.
-
getFrameIndex
public int getFrameIndex()
Returns the current frame index.This is the current number of nested
push()calls.
-
getPointerAddress
public long getPointerAddress()
Returns the memory address at the current stack pointer.
-
getPointer
public int getPointer()
Returns the current stack pointer.The stack grows "downwards", so when the stack is empty
pointeris equal tosize. On every allocationpointeris reduced by the allocated size (after alignment) andaddress + pointerpoints to the first byte of the last allocation.Effectively, this methods returns how many more bytes may be allocated on the stack.
-
setPointer
public void setPointer(int pointer)
Sets the current stack pointer.This method directly manipulates the stack pointer. Using it irresponsibly may break the internal state of the stack. It should only be used in rare cases or in auto-generated code.
-
nmalloc
public long nmalloc(int size)
Callsnmalloc(int, int)withalignmentequal to 1.- Parameters:
size- the allocation size- Returns:
- the memory address on the stack for the requested allocation
-
nmalloc
public long nmalloc(int alignment, int size)Allocates a block ofsizebytes of memory on the stack. The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.- Parameters:
alignment- the required alignmentsize- the allocation size- Returns:
- the memory address on the stack for the requested allocation
-
ncalloc
public long ncalloc(int alignment, int num, int size)Allocates a block of memory on the stack for an array ofnumelements, each of themsizebytes long, and initializes all its bits to zero.- Parameters:
alignment- the required element alignmentnum- num the number of elements to allocatesize- the size of each element- Returns:
- the memory address on the stack for the requested allocation
-
malloc
public java.nio.ByteBuffer malloc(int alignment, int size)Allocates an alignedByteBufferon the stack.- Parameters:
alignment- the required buffer alignmentsize- the number of elements in the buffer- Returns:
- the allocated buffer
-
calloc
public java.nio.ByteBuffer calloc(int alignment, int size)Calloc version ofmalloc(int, int).
-
malloc
public java.nio.ByteBuffer malloc(int size)
Allocates aByteBufferon the stack.- Parameters:
size- the number of elements in the buffer- Returns:
- the allocated buffer
-
calloc
public java.nio.ByteBuffer calloc(int size)
Calloc version ofmalloc(int).
-
bytes
public java.nio.ByteBuffer bytes(byte x)
Single value version ofmalloc(int, int).
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y)Two value version ofmalloc(int, int).
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z)Three value version ofmalloc(int, int).
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z, byte w)Four value version ofmalloc(int, int).
-
bytes
public java.nio.ByteBuffer bytes(byte... values)
Vararg version ofmalloc(int, int).
-
mallocShort
public java.nio.ShortBuffer mallocShort(int size)
Short version ofmalloc(int).
-
callocShort
public java.nio.ShortBuffer callocShort(int size)
Short version ofcalloc(int).
-
shorts
public java.nio.ShortBuffer shorts(short x)
Single value version ofmallocShort(int).
-
shorts
public java.nio.ShortBuffer shorts(short x, short y)Two value version ofmallocShort(int).
-
shorts
public java.nio.ShortBuffer shorts(short x, short y, short z)Three value version ofmallocShort(int).
-
shorts
public java.nio.ShortBuffer shorts(short x, short y, short z, short w)Four value version ofmallocShort(int).
-
shorts
public java.nio.ShortBuffer shorts(short... values)
Vararg version ofmallocShort(int).
-
mallocInt
public java.nio.IntBuffer mallocInt(int size)
Int version ofmalloc(int).
-
callocInt
public java.nio.IntBuffer callocInt(int size)
Int version ofcalloc(int).
-
ints
public java.nio.IntBuffer ints(int x)
Single value version ofmallocInt(int).
-
ints
public java.nio.IntBuffer ints(int x, int y)Two value version ofmallocInt(int).
-
ints
public java.nio.IntBuffer ints(int x, int y, int z)Three value version ofmallocInt(int).
-
ints
public java.nio.IntBuffer ints(int x, int y, int z, int w)Four value version ofmallocInt(int).
-
ints
public java.nio.IntBuffer ints(int... values)
Vararg version ofmallocInt(int).
-
mallocLong
public java.nio.LongBuffer mallocLong(int size)
Long version ofmalloc(int).
-
callocLong
public java.nio.LongBuffer callocLong(int size)
Long version ofcalloc(int).
-
longs
public java.nio.LongBuffer longs(long x)
Single value version ofmallocLong(int).
-
longs
public java.nio.LongBuffer longs(long x, long y)Two value version ofmallocLong(int).
-
longs
public java.nio.LongBuffer longs(long x, long y, long z)Three value version ofmallocLong(int).
-
longs
public java.nio.LongBuffer longs(long x, long y, long z, long w)Four value version ofmallocLong(int).
-
longs
public java.nio.LongBuffer longs(long... more)
Vararg version ofmallocLong(int).
-
mallocCLong
public CLongBuffer mallocCLong(int size)
CLong version ofmalloc(int).
-
callocCLong
public CLongBuffer callocCLong(int size)
CLong version ofcalloc(int).
-
clongs
public CLongBuffer clongs(long x)
Single value version ofmallocCLong(int).
-
clongs
public CLongBuffer clongs(long x, long y)
Two value version ofmallocCLong(int).
-
clongs
public CLongBuffer clongs(long x, long y, long z)
Three value version ofmallocCLong(int).
-
clongs
public CLongBuffer clongs(long x, long y, long z, long w)
Four value version ofmallocCLong(int).
-
clongs
public CLongBuffer clongs(long... values)
Vararg version ofmallocCLong(int).
-
mallocFloat
public java.nio.FloatBuffer mallocFloat(int size)
Float version ofmalloc(int).
-
callocFloat
public java.nio.FloatBuffer callocFloat(int size)
Float version ofcalloc(int).
-
floats
public java.nio.FloatBuffer floats(float x)
Single value version ofmallocFloat(int).
-
floats
public java.nio.FloatBuffer floats(float x, float y)Two value version ofmallocFloat(int).
-
floats
public java.nio.FloatBuffer floats(float x, float y, float z)Three value version ofmallocFloat(int).
-
floats
public java.nio.FloatBuffer floats(float x, float y, float z, float w)Four value version ofmallocFloat(int).
-
floats
public java.nio.FloatBuffer floats(float... values)
Vararg version ofmallocFloat(int).
-
mallocDouble
public java.nio.DoubleBuffer mallocDouble(int size)
Double version ofmalloc(int).
-
callocDouble
public java.nio.DoubleBuffer callocDouble(int size)
Double version ofcalloc(int).
-
doubles
public java.nio.DoubleBuffer doubles(double x)
Single value version ofmallocDouble(int).
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y)Two value version ofmallocDouble(int).
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y, double z)Three value version ofmallocDouble(int).
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y, double z, double w)Four value version ofmallocDouble(int).
-
doubles
public java.nio.DoubleBuffer doubles(double... values)
Vararg version ofmallocDouble(int).
-
mallocPointer
public PointerBuffer mallocPointer(int size)
Pointer version ofmalloc(int).
-
callocPointer
public PointerBuffer callocPointer(int size)
Pointer version ofcalloc(int).
-
pointers
public PointerBuffer pointers(long x)
Single value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(long x, long y)
Two value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(long x, long y, long z)
Three value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(long x, long y, long z, long w)
Four value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(long... values)
Vararg version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(Pointer x)
Single value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y)
Two value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y, Pointer z)
Three value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y, Pointer z, Pointer w)
Four value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(Pointer... values)
Vararg version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(java.nio.Buffer x)
Single value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(java.nio.Buffer x, java.nio.Buffer y)
Two value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z)
Three value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z, java.nio.Buffer w)
Four value version ofmallocPointer(int).
-
pointers
public PointerBuffer pointers(java.nio.Buffer... values)
Vararg version ofmallocPointer(int).
-
ASCII
public java.nio.ByteBuffer ASCII(java.lang.CharSequence text)
Encodes the specified text on the stack using ASCII encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.- Parameters:
text- the text to encode
-
ASCII
public java.nio.ByteBuffer ASCII(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using ASCII encoding and returns a ByteBuffer that points to the encoded text.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
nASCII
public int nASCII(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using ASCII encoding and returns the encoded text length, in bytes.Use
getPointerAddress()immediately after this method to get the encoded text address.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
ASCIISafe
@Nullable public java.nio.ByteBuffer ASCIISafe(@Nullable java.lang.CharSequence text)
-
ASCIISafe
@Nullable public java.nio.ByteBuffer ASCIISafe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
nASCIISafe
public int nASCIISafe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
UTF8
public java.nio.ByteBuffer UTF8(java.lang.CharSequence text)
Encodes the specified text on the stack using UTF8 encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.- Parameters:
text- the text to encode
-
UTF8
public java.nio.ByteBuffer UTF8(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF8 encoding and returns a ByteBuffer that points to the encoded text.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
nUTF8
public int nUTF8(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF8 encoding and returns the encoded text length, in bytes.Use
getPointerAddress()immediately after this method to get the encoded text address.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
UTF8Safe
@Nullable public java.nio.ByteBuffer UTF8Safe(@Nullable java.lang.CharSequence text)
-
UTF8Safe
@Nullable public java.nio.ByteBuffer UTF8Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
nUTF8Safe
public int nUTF8Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
UTF16
public java.nio.ByteBuffer UTF16(java.lang.CharSequence text)
Encodes the specified text on the stack using UTF16 encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.- Parameters:
text- the text to encode
-
UTF16
public java.nio.ByteBuffer UTF16(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF16 encoding and returns a ByteBuffer that points to the encoded text.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
nUTF16
public int nUTF16(java.lang.CharSequence text, boolean nullTerminated)Encodes the specified text on the stack using UTF16 encoding and returns the encoded text length, in bytes.Use
getPointerAddress()immediately after this method to get the encoded text address.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
UTF16Safe
@Nullable public java.nio.ByteBuffer UTF16Safe(@Nullable java.lang.CharSequence text)
-
UTF16Safe
@Nullable public java.nio.ByteBuffer UTF16Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
nUTF16Safe
public int nUTF16Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
stackGet
public static MemoryStack stackGet()
Returns the stack of the current thread.
-
stackPush
public static MemoryStack stackPush()
Callspush()on the stack of the current thread.- Returns:
- the stack of the current thread.
-
stackPop
public static MemoryStack stackPop()
Callspop()on the stack of the current thread.- Returns:
- the stack of the current thread.
-
nstackMalloc
public static long nstackMalloc(int size)
Thread-local version ofnmalloc(int).
-
nstackMalloc
public static long nstackMalloc(int alignment, int size)Thread-local version ofnmalloc(int, int).
-
nstackCalloc
public static long nstackCalloc(int alignment, int num, int size)Thread-local version ofncalloc(int, int, int).
-
stackMalloc
public static java.nio.ByteBuffer stackMalloc(int size)
Thread-local version ofmalloc(int, int).
-
stackCalloc
public static java.nio.ByteBuffer stackCalloc(int size)
Thread-local version ofcalloc(int, int).
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x)
Thread-local version ofbytes(byte).
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y)Thread-local version ofbytes(byte, byte).
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y, byte z)Thread-local version ofbytes(byte, byte, byte).
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y, byte z, byte w)Thread-local version ofbytes(byte, byte, byte, byte).
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte... values)
Thread-local version ofbytes(byte...).
-
stackMallocShort
public static java.nio.ShortBuffer stackMallocShort(int size)
Thread-local version ofmallocShort(int).
-
stackCallocShort
public static java.nio.ShortBuffer stackCallocShort(int size)
Thread-local version ofcallocShort(int).
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x)
Thread-local version ofshorts(short).
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y)Thread-local version ofshorts(short, short).
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y, short z)Thread-local version ofshorts(short, short, short).
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y, short z, short w)Thread-local version ofshorts(short, short, short, short).
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short... values)
Thread-local version ofshorts(short...).
-
stackMallocInt
public static java.nio.IntBuffer stackMallocInt(int size)
Thread-local version ofmallocInt(int).
-
stackCallocInt
public static java.nio.IntBuffer stackCallocInt(int size)
Thread-local version ofcallocInt(int).
-
stackInts
public static java.nio.IntBuffer stackInts(int x)
Thread-local version ofints(int).
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y)Thread-local version ofints(int, int).
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y, int z)Thread-local version ofints(int, int, int).
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y, int z, int w)Thread-local version ofints(int, int, int, int).
-
stackInts
public static java.nio.IntBuffer stackInts(int... values)
Thread-local version ofints(int...).
-
stackMallocLong
public static java.nio.LongBuffer stackMallocLong(int size)
Thread-local version ofmallocLong(int).
-
stackCallocLong
public static java.nio.LongBuffer stackCallocLong(int size)
Thread-local version ofcallocLong(int).
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x)
Thread-local version oflongs(long).
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y)Thread-local version oflongs(long, long).
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y, long z)Thread-local version oflongs(long, long, long).
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y, long z, long w)Thread-local version oflongs(long, long, long, long).
-
stackLongs
public static java.nio.LongBuffer stackLongs(long... values)
Thread-local version oflongs(long...).
-
stackMallocCLong
public static CLongBuffer stackMallocCLong(int size)
Thread-local version ofmallocCLong(int).
-
stackCallocCLong
public static CLongBuffer stackCallocCLong(int size)
Thread-local version ofcallocCLong(int).
-
stackCLongs
public static CLongBuffer stackCLongs(long x)
Thread-local version oflongs(long).
-
stackCLongs
public static CLongBuffer stackCLongs(long x, long y)
Thread-local version oflongs(long, long).
-
stackCLongs
public static CLongBuffer stackCLongs(long x, long y, long z)
Thread-local version oflongs(long, long, long).
-
stackCLongs
public static CLongBuffer stackCLongs(long x, long y, long z, long w)
Thread-local version oflongs(long, long, long, long).
-
stackCLongs
public static CLongBuffer stackCLongs(long... values)
Thread-local version oflongs(long...).
-
stackMallocFloat
public static java.nio.FloatBuffer stackMallocFloat(int size)
Thread-local version ofmallocFloat(int).
-
stackCallocFloat
public static java.nio.FloatBuffer stackCallocFloat(int size)
Thread-local version ofcallocFloat(int).
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x)
Thread-local version offloats(float).
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y)Thread-local version offloats(float, float).
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y, float z)Thread-local version offloats(float, float, float).
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y, float z, float w)Thread-local version offloats(float, float, float, float).
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float... values)
Thread-local version offloats(float...).
-
stackMallocDouble
public static java.nio.DoubleBuffer stackMallocDouble(int size)
Thread-local version ofmallocDouble(int).
-
stackCallocDouble
public static java.nio.DoubleBuffer stackCallocDouble(int size)
Thread-local version ofcallocDouble(int).
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x)
Thread-local version ofdoubles(double).
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y)Thread-local version ofdoubles(double, double).
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y, double z)Thread-local version ofdoubles(double, double, double).
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y, double z, double w)Thread-local version ofdoubles(double, double, double, double).
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double... values)
Thread-local version ofdoubles(double...).
-
stackMallocPointer
public static PointerBuffer stackMallocPointer(int size)
Thread-local version ofmallocPointer(int).
-
stackCallocPointer
public static PointerBuffer stackCallocPointer(int size)
Thread-local version ofcallocPointer(int).
-
stackPointers
public static PointerBuffer stackPointers(long x)
Thread-local version ofpointers(long).
-
stackPointers
public static PointerBuffer stackPointers(long x, long y)
Thread-local version ofpointers(long, long).
-
stackPointers
public static PointerBuffer stackPointers(long x, long y, long z)
Thread-local version ofpointers(long, long, long).
-
stackPointers
public static PointerBuffer stackPointers(long x, long y, long z, long w)
Thread-local version ofpointers(long, long, long, long).
-
stackPointers
public static PointerBuffer stackPointers(long... values)
Thread-local version ofpointers(long...).
-
stackPointers
public static PointerBuffer stackPointers(Pointer x)
Thread-local version ofpointers(Pointer).
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y)
Thread-local version ofpointers(Pointer, Pointer).
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y, Pointer z)
Thread-local version ofpointers(Pointer, Pointer, Pointer).
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y, Pointer z, Pointer w)
Thread-local version ofpointers(Pointer, Pointer, Pointer, Pointer).
-
stackPointers
public static PointerBuffer stackPointers(Pointer... values)
Thread-local version ofpointers(Pointer...).
-
stackASCII
public static java.nio.ByteBuffer stackASCII(java.lang.CharSequence text)
Thread-local version ofASCII(CharSequence).
-
stackASCII
public static java.nio.ByteBuffer stackASCII(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofASCII(CharSequence, boolean).
-
stackUTF8
public static java.nio.ByteBuffer stackUTF8(java.lang.CharSequence text)
Thread-local version ofUTF8(CharSequence).
-
stackUTF8
public static java.nio.ByteBuffer stackUTF8(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF8(CharSequence, boolean).
-
stackUTF16
public static java.nio.ByteBuffer stackUTF16(java.lang.CharSequence text)
Thread-local version ofUTF16(CharSequence).
-
stackUTF16
public static java.nio.ByteBuffer stackUTF16(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF16(CharSequence, boolean).
-
stackASCIISafe
@Nullable public static java.nio.ByteBuffer stackASCIISafe(@Nullable java.lang.CharSequence text)Thread-local version ofASCII(CharSequence).
-
stackASCIISafe
@Nullable public static java.nio.ByteBuffer stackASCIISafe(@Nullable java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofASCII(CharSequence, boolean).
-
stackUTF8Safe
@Nullable public static java.nio.ByteBuffer stackUTF8Safe(@Nullable java.lang.CharSequence text)Thread-local version ofUTF8(CharSequence).
-
stackUTF8Safe
@Nullable public static java.nio.ByteBuffer stackUTF8Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF8(CharSequence, boolean).
-
stackUTF16Safe
@Nullable public static java.nio.ByteBuffer stackUTF16Safe(@Nullable java.lang.CharSequence text)Thread-local version ofUTF16(CharSequence).
-
stackUTF16Safe
@Nullable public static java.nio.ByteBuffer stackUTF16Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofUTF16(CharSequence, boolean).
-
-