Class MemoryStack
- java.lang.Object
-
- org.lwjgl.system.MemoryStack
-
- All Implemented Interfaces:
- java.lang.AutoCloseable
public class MemoryStack extends java.lang.Object implements java.lang.AutoCloseable
An off-heap memory stack.This class should be used in a thread-local manner for stack allocations.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description 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.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.java.nio.ByteBuffer
bytes(byte... values)
Vararg version ofMemoryStack.malloc(int, int)
.java.nio.ByteBuffer
bytes(byte x)
Single value version ofMemoryStack.malloc(int, int)
.java.nio.ByteBuffer
bytes(byte x, byte y)
Two value version ofMemoryStack.malloc(int, int)
.java.nio.ByteBuffer
bytes(byte x, byte y, byte z)
Three value version ofMemoryStack.malloc(int, int)
.java.nio.ByteBuffer
bytes(byte x, byte y, byte z, byte w)
Four value version ofMemoryStack.malloc(int, int)
.java.nio.ByteBuffer
calloc(int size)
Calloc version ofMemoryStack.malloc(int)
.java.nio.ByteBuffer
calloc(int alignment, int size)
Calloc version ofMemoryStack.malloc(int, int)
.java.nio.DoubleBuffer
callocDouble(int size)
Double version ofMemoryStack.calloc(int)
.java.nio.FloatBuffer
callocFloat(int size)
Float version ofMemoryStack.calloc(int)
.java.nio.IntBuffer
callocInt(int size)
Int version ofMemoryStack.calloc(int)
.java.nio.LongBuffer
callocLong(int size)
Long version ofMemoryStack.calloc(int)
.PointerBuffer
callocPointer(int size)
Pointer version ofMemoryStack.calloc(int)
.java.nio.ShortBuffer
callocShort(int size)
Short version ofMemoryStack.calloc(int)
.void
close()
CallsMemoryStack.pop()
on thisMemoryStack
.static MemoryStack
create()
Creates a newMemoryStack
with the default size.static MemoryStack
create(int size)
Creates a newMemoryStack
with the specified size.java.nio.DoubleBuffer
doubles(double... values)
Vararg version ofMemoryStack.mallocDouble(int)
.java.nio.DoubleBuffer
doubles(double x)
Single value version ofMemoryStack.mallocDouble(int)
.java.nio.DoubleBuffer
doubles(double x, double y)
Two value version ofMemoryStack.mallocDouble(int)
.java.nio.DoubleBuffer
doubles(double x, double y, double z)
Three value version ofMemoryStack.mallocDouble(int)
.java.nio.DoubleBuffer
doubles(double x, double y, double z, double w)
Four value version ofMemoryStack.mallocDouble(int)
.java.nio.FloatBuffer
floats(float... values)
Vararg version ofMemoryStack.mallocFloat(int)
.java.nio.FloatBuffer
floats(float x)
Single value version ofMemoryStack.mallocFloat(int)
.java.nio.FloatBuffer
floats(float x, float y)
Two value version ofMemoryStack.mallocFloat(int)
.java.nio.FloatBuffer
floats(float x, float y, float z)
Three value version ofMemoryStack.mallocFloat(int)
.java.nio.FloatBuffer
floats(float x, float y, float z, float w)
Four value version ofMemoryStack.mallocFloat(int)
.long
getAddress()
Returns the address of the backing off-heap memory.int
getFrameIndex()
Returns the current frame index.int
getPointer()
Returns the current stack pointer.int
getSize()
Returns the size of the backing off-heap memory.java.nio.IntBuffer
ints(int... values)
Vararg version ofMemoryStack.mallocInt(int)
.java.nio.IntBuffer
ints(int x)
Single value version ofMemoryStack.mallocInt(int)
.java.nio.IntBuffer
ints(int x, int y)
Two value version ofMemoryStack.mallocInt(int)
.java.nio.IntBuffer
ints(int x, int y, int z)
Three value version ofMemoryStack.mallocInt(int)
.java.nio.IntBuffer
ints(int x, int y, int z, int w)
Four value version ofMemoryStack.mallocInt(int)
.java.nio.LongBuffer
longs(long... more)
Vararg version ofMemoryStack.mallocLong(int)
.java.nio.LongBuffer
longs(long x)
Single value version ofMemoryStack.mallocLong(int)
.java.nio.LongBuffer
longs(long x, long y)
Two value version ofMemoryStack.mallocLong(int)
.java.nio.LongBuffer
longs(long x, long y, long z)
Three value version ofMemoryStack.mallocLong(int)
.java.nio.LongBuffer
longs(long x, long y, long z, long w)
Four value version ofMemoryStack.mallocLong(int)
.java.nio.ByteBuffer
malloc(int size)
Allocates aByteBuffer
on the stack.java.nio.ByteBuffer
malloc(int alignment, int size)
Allocates an alignedByteBuffer
on the stack.java.nio.DoubleBuffer
mallocDouble(int size)
Double version ofMemoryStack.malloc(int)
.java.nio.FloatBuffer
mallocFloat(int size)
Float version ofMemoryStack.malloc(int)
.java.nio.IntBuffer
mallocInt(int size)
Int version ofMemoryStack.malloc(int)
.java.nio.LongBuffer
mallocLong(int size)
Long version ofMemoryStack.malloc(int)
.PointerBuffer
mallocPointer(int size)
Pointer version ofMemoryStack.malloc(int)
.java.nio.ShortBuffer
mallocShort(int size)
Short version ofMemoryStack.malloc(int)
.long
ncalloc(int alignment, int num, int size)
Allocates a block of memory on the stack for an array ofnum
elements, each of themsize
bytes long, and initializes all its bits to zero.long
nmalloc(int size)
CallsMemoryStack.nmalloc(int, int)
withalignment
equal to 1.long
nmalloc(int alignment, int size)
Allocates a block ofsize
bytes of memory on the stack.PointerBuffer
pointers(long... values)
Vararg version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(long x)
Single value version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(long x, long y)
Two value version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(long x, long y, long z)
Three value version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(long x, long y, long z, long w)
Four value version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(Pointer... values)
Vararg version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(Pointer x)
Single value version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(Pointer x, Pointer y)
Two value version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(Pointer x, Pointer y, Pointer z)
Three value version ofMemoryStack.mallocPointer(int)
.PointerBuffer
pointers(Pointer x, Pointer y, Pointer z, Pointer w)
Four value version ofMemoryStack.mallocPointer(int)
.MemoryStack
pop()
Pops the current stack frame and moves the stack pointer to the end of the previous stack frame.MemoryStack
push()
Stores the current stack pointer and pushes a new frame to the stack.void
setPointer(int pointer)
Sets the current stack pointer.java.nio.ShortBuffer
shorts(short... values)
Vararg version ofMemoryStack.mallocShort(int)
.java.nio.ShortBuffer
shorts(short x)
Single value version ofMemoryStack.mallocShort(int)
.java.nio.ShortBuffer
shorts(short x, short y)
Two value version ofMemoryStack.mallocShort(int)
.java.nio.ShortBuffer
shorts(short x, short y, short z)
Three value version ofMemoryStack.mallocShort(int)
.java.nio.ShortBuffer
shorts(short x, short y, short z, short w)
Four value version ofMemoryStack.mallocShort(int)
.static java.nio.ByteBuffer
stackASCII(java.lang.CharSequence text)
Thread-local version ofMemoryStack.ASCII(CharSequence)
.static java.nio.ByteBuffer
stackASCII(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofMemoryStack.ASCII(CharSequence, boolean)
.static java.nio.ByteBuffer
stackBytes(byte... values)
Thread-local version ofMemoryStack.bytes(byte...)
.static java.nio.ByteBuffer
stackBytes(byte x)
Thread-local version ofMemoryStack.bytes(byte)
.static java.nio.ByteBuffer
stackBytes(byte x, byte y)
Thread-local version ofMemoryStack.bytes(byte, byte)
.static java.nio.ByteBuffer
stackBytes(byte x, byte y, byte z)
Thread-local version ofMemoryStack.bytes(byte, byte, byte)
.static java.nio.ByteBuffer
stackBytes(byte x, byte y, byte z, byte w)
Thread-local version ofMemoryStack.bytes(byte, byte, byte, byte)
.static java.nio.ByteBuffer
stackCalloc(int size)
Thread-local version ofMemoryStack.calloc(int, int)
.static java.nio.DoubleBuffer
stackCallocDouble(int size)
Thread-local version ofMemoryStack.callocDouble(int)
.static java.nio.FloatBuffer
stackCallocFloat(int size)
Thread-local version ofMemoryStack.callocFloat(int)
.static java.nio.IntBuffer
stackCallocInt(int size)
Thread-local version ofMemoryStack.callocInt(int)
.static java.nio.LongBuffer
stackCallocLong(int size)
Thread-local version ofMemoryStack.callocLong(int)
.static PointerBuffer
stackCallocPointer(int size)
Thread-local version ofMemoryStack.callocPointer(int)
.static java.nio.ShortBuffer
stackCallocShort(int size)
Thread-local version ofMemoryStack.callocShort(int)
.static java.nio.DoubleBuffer
stackDoubles(double... values)
Thread-local version ofMemoryStack.doubles(double...)
.static java.nio.DoubleBuffer
stackDoubles(double x)
Thread-local version ofMemoryStack.doubles(double)
.static java.nio.DoubleBuffer
stackDoubles(double x, double y)
Thread-local version ofMemoryStack.doubles(double, double)
.static java.nio.DoubleBuffer
stackDoubles(double x, double y, double z)
Thread-local version ofMemoryStack.doubles(double, double, double)
.static java.nio.DoubleBuffer
stackDoubles(double x, double y, double z, double w)
Thread-local version ofMemoryStack.doubles(double, double, double, double)
.static java.nio.FloatBuffer
stackFloats(float... values)
Thread-local version ofMemoryStack.floats(float...)
.static java.nio.FloatBuffer
stackFloats(float x)
Thread-local version ofMemoryStack.floats(float)
.static java.nio.FloatBuffer
stackFloats(float x, float y)
Thread-local version ofMemoryStack.floats(float, float)
.static java.nio.FloatBuffer
stackFloats(float x, float y, float z)
Thread-local version ofMemoryStack.floats(float, float, float)
.static java.nio.FloatBuffer
stackFloats(float x, float y, float z, float w)
Thread-local version ofMemoryStack.floats(float, float, float, float)
.static MemoryStack
stackGet()
Returns the stack of the current thread.static java.nio.IntBuffer
stackInts(int... values)
Thread-local version ofMemoryStack.ints(int...)
.static java.nio.IntBuffer
stackInts(int x)
Thread-local version ofMemoryStack.ints(int)
.static java.nio.IntBuffer
stackInts(int x, int y)
Thread-local version ofMemoryStack.ints(int, int)
.static java.nio.IntBuffer
stackInts(int x, int y, int z)
Thread-local version ofMemoryStack.ints(int, int, int)
.static java.nio.IntBuffer
stackInts(int x, int y, int z, int w)
Thread-local version ofMemoryStack.ints(int, int, int, int)
.static java.nio.LongBuffer
stackLongs(long... values)
Thread-local version ofMemoryStack.longs(long...)
.static java.nio.LongBuffer
stackLongs(long x)
Thread-local version ofMemoryStack.longs(long)
.static java.nio.LongBuffer
stackLongs(long x, long y)
Thread-local version ofMemoryStack.longs(long, long)
.static java.nio.LongBuffer
stackLongs(long x, long y, long z)
Thread-local version ofMemoryStack.longs(long, long, long)
.static java.nio.LongBuffer
stackLongs(long x, long y, long z, long w)
Thread-local version ofMemoryStack.longs(long, long, long, long)
.static java.nio.ByteBuffer
stackMalloc(int size)
Thread-local version ofMemoryStack.malloc(int, int)
.static java.nio.DoubleBuffer
stackMallocDouble(int size)
Thread-local version ofMemoryStack.mallocDouble(int)
.static java.nio.FloatBuffer
stackMallocFloat(int size)
Thread-local version ofMemoryStack.mallocFloat(int)
.static java.nio.IntBuffer
stackMallocInt(int size)
Thread-local version ofMemoryStack.mallocInt(int)
.static java.nio.LongBuffer
stackMallocLong(int size)
Thread-local version ofMemoryStack.mallocLong(int)
.static PointerBuffer
stackMallocPointer(int size)
Thread-local version ofMemoryStack.mallocPointer(int)
.static java.nio.ShortBuffer
stackMallocShort(int size)
Thread-local version ofMemoryStack.mallocShort(int)
.static PointerBuffer
stackPointers(long... values)
Thread-local version ofMemoryStack.pointers(long...)
.static PointerBuffer
stackPointers(long x)
Thread-local version ofMemoryStack.pointers(long)
.static PointerBuffer
stackPointers(long x, long y)
Thread-local version ofMemoryStack.pointers(long, long)
.static PointerBuffer
stackPointers(long x, long y, long z)
Thread-local version ofMemoryStack.pointers(long, long, long)
.static PointerBuffer
stackPointers(long x, long y, long z, long w)
Thread-local version ofMemoryStack.pointers(long, long, long, long)
.static PointerBuffer
stackPointers(Pointer... values)
Thread-local version ofMemoryStack.pointers(Pointer...)
.static PointerBuffer
stackPointers(Pointer x)
Thread-local version ofMemoryStack.pointers(Pointer)
.static PointerBuffer
stackPointers(Pointer x, Pointer y)
Thread-local version ofMemoryStack.pointers(Pointer, Pointer)
.static PointerBuffer
stackPointers(Pointer x, Pointer y, Pointer z)
Thread-local version ofMemoryStack.pointers(Pointer, Pointer, Pointer)
.static PointerBuffer
stackPointers(Pointer x, Pointer y, Pointer z, Pointer w)
Thread-local version ofMemoryStack.pointers(Pointer, Pointer, Pointer, Pointer)
.static MemoryStack
stackPop()
CallsMemoryStack.pop()
on the stack of the current thread.static MemoryStack
stackPush()
CallsMemoryStack.push()
on the stack of the current thread.static java.nio.ShortBuffer
stackShorts(short... values)
Thread-local version ofMemoryStack.shorts(short...)
.static java.nio.ShortBuffer
stackShorts(short x)
Thread-local version ofMemoryStack.shorts(short)
.static java.nio.ShortBuffer
stackShorts(short x, short y)
Thread-local version ofMemoryStack.shorts(short, short)
.static java.nio.ShortBuffer
stackShorts(short x, short y, short z)
Thread-local version ofMemoryStack.shorts(short, short, short)
.static java.nio.ShortBuffer
stackShorts(short x, short y, short z, short w)
Thread-local version ofMemoryStack.shorts(short, short, short, short)
.static java.nio.ByteBuffer
stackUTF16(java.lang.CharSequence text)
Thread-local version ofMemoryStack.UTF16(CharSequence)
.static java.nio.ByteBuffer
stackUTF16(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofMemoryStack.UTF16(CharSequence, boolean)
.static java.nio.ByteBuffer
stackUTF8(java.lang.CharSequence text)
Thread-local version ofMemoryStack.UTF8(CharSequence)
.static java.nio.ByteBuffer
stackUTF8(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofMemoryStack.UTF8(CharSequence, boolean)
.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.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.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.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.
-
-
-
Method Detail
-
create
public static MemoryStack create()
Creates a newMemoryStack
with the default size.
-
create
public static MemoryStack create(int size)
Creates a newMemoryStack
with the specified size.- Parameters:
size
- the maximum number of bytes that may be allocated on the stack
-
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
MemoryStack.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()
CallsMemoryStack.pop()
on thisMemoryStack
.This method should not be used directly. It is called automatically when the
MemoryStack
is used as a resource in a try-with-resources statement.- Specified by:
close
in 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
MemoryStack.push()
calls.
-
getPointer
public int getPointer()
Returns the current stack pointer.The stack grows "downwards", so when the stack is empty
pointer
is equal tosize
. On every allocationpointer
is reduced by the allocated size (after alignment) andaddress + pointers
points to the last 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)
CallsMemoryStack.nmalloc(int, int)
withalignment
equal 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 ofsize
bytes 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 ofnum
elements, each of themsize
bytes 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 alignedByteBuffer
on 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 ofMemoryStack.malloc(int, int)
.
-
malloc
public java.nio.ByteBuffer malloc(int size)
Allocates aByteBuffer
on 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 ofMemoryStack.malloc(int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x)
Single value version ofMemoryStack.malloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y)
Two value version ofMemoryStack.malloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z)
Three value version ofMemoryStack.malloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z, byte w)
Four value version ofMemoryStack.malloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte... values)
Vararg version ofMemoryStack.malloc(int, int)
.
-
mallocShort
public java.nio.ShortBuffer mallocShort(int size)
Short version ofMemoryStack.malloc(int)
.
-
callocShort
public java.nio.ShortBuffer callocShort(int size)
Short version ofMemoryStack.calloc(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x)
Single value version ofMemoryStack.mallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x, short y)
Two value version ofMemoryStack.mallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x, short y, short z)
Three value version ofMemoryStack.mallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x, short y, short z, short w)
Four value version ofMemoryStack.mallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short... values)
Vararg version ofMemoryStack.mallocShort(int)
.
-
mallocInt
public java.nio.IntBuffer mallocInt(int size)
Int version ofMemoryStack.malloc(int)
.
-
callocInt
public java.nio.IntBuffer callocInt(int size)
Int version ofMemoryStack.calloc(int)
.
-
ints
public java.nio.IntBuffer ints(int x)
Single value version ofMemoryStack.mallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int x, int y)
Two value version ofMemoryStack.mallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int x, int y, int z)
Three value version ofMemoryStack.mallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int x, int y, int z, int w)
Four value version ofMemoryStack.mallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int... values)
Vararg version ofMemoryStack.mallocInt(int)
.
-
mallocLong
public java.nio.LongBuffer mallocLong(int size)
Long version ofMemoryStack.malloc(int)
.
-
callocLong
public java.nio.LongBuffer callocLong(int size)
Long version ofMemoryStack.calloc(int)
.
-
longs
public java.nio.LongBuffer longs(long x)
Single value version ofMemoryStack.mallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long x, long y)
Two value version ofMemoryStack.mallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long x, long y, long z)
Three value version ofMemoryStack.mallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long x, long y, long z, long w)
Four value version ofMemoryStack.mallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long... more)
Vararg version ofMemoryStack.mallocLong(int)
.
-
mallocFloat
public java.nio.FloatBuffer mallocFloat(int size)
Float version ofMemoryStack.malloc(int)
.
-
callocFloat
public java.nio.FloatBuffer callocFloat(int size)
Float version ofMemoryStack.calloc(int)
.
-
floats
public java.nio.FloatBuffer floats(float x)
Single value version ofMemoryStack.mallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float x, float y)
Two value version ofMemoryStack.mallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float x, float y, float z)
Three value version ofMemoryStack.mallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float x, float y, float z, float w)
Four value version ofMemoryStack.mallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float... values)
Vararg version ofMemoryStack.mallocFloat(int)
.
-
mallocDouble
public java.nio.DoubleBuffer mallocDouble(int size)
Double version ofMemoryStack.malloc(int)
.
-
callocDouble
public java.nio.DoubleBuffer callocDouble(int size)
Double version ofMemoryStack.calloc(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x)
Single value version ofMemoryStack.mallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y)
Two value version ofMemoryStack.mallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y, double z)
Three value version ofMemoryStack.mallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y, double z, double w)
Four value version ofMemoryStack.mallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double... values)
Vararg version ofMemoryStack.mallocDouble(int)
.
-
mallocPointer
public PointerBuffer mallocPointer(int size)
Pointer version ofMemoryStack.malloc(int)
.
-
callocPointer
public PointerBuffer callocPointer(int size)
Pointer version ofMemoryStack.calloc(int)
.
-
pointers
public PointerBuffer pointers(long x)
Single value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long x, long y)
Two value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long x, long y, long z)
Three value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long x, long y, long z, long w)
Four value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long... values)
Vararg version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x)
Single value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y)
Two value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y, Pointer z)
Three value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y, Pointer z, Pointer w)
Four value version ofMemoryStack.mallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer... values)
Vararg version ofMemoryStack.mallocPointer(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. Iftext
is null, null is returned.
-
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 encode. Iftext
is null, null is returned.nullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
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. Iftext
is null, null is returned.
-
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 encode. Iftext
is null, null is returned.nullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
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. Iftext
is null, null is returned.
-
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 encode. Iftext
is null, null is returned.nullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
stackGet
public static MemoryStack stackGet()
Returns the stack of the current thread.
-
stackPush
public static MemoryStack stackPush()
CallsMemoryStack.push()
on the stack of the current thread.- Returns:
- the stack of the current thread.
-
stackPop
public static MemoryStack stackPop()
CallsMemoryStack.pop()
on the stack of the current thread.- Returns:
- the stack of the current thread.
-
stackMalloc
public static java.nio.ByteBuffer stackMalloc(int size)
Thread-local version ofMemoryStack.malloc(int, int)
.
-
stackCalloc
public static java.nio.ByteBuffer stackCalloc(int size)
Thread-local version ofMemoryStack.calloc(int, int)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x)
Thread-local version ofMemoryStack.bytes(byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y)
Thread-local version ofMemoryStack.bytes(byte, byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y, byte z)
Thread-local version ofMemoryStack.bytes(byte, byte, byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y, byte z, byte w)
Thread-local version ofMemoryStack.bytes(byte, byte, byte, byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte... values)
Thread-local version ofMemoryStack.bytes(byte...)
.
-
stackMallocShort
public static java.nio.ShortBuffer stackMallocShort(int size)
Thread-local version ofMemoryStack.mallocShort(int)
.
-
stackCallocShort
public static java.nio.ShortBuffer stackCallocShort(int size)
Thread-local version ofMemoryStack.callocShort(int)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x)
Thread-local version ofMemoryStack.shorts(short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y)
Thread-local version ofMemoryStack.shorts(short, short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y, short z)
Thread-local version ofMemoryStack.shorts(short, short, short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y, short z, short w)
Thread-local version ofMemoryStack.shorts(short, short, short, short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short... values)
Thread-local version ofMemoryStack.shorts(short...)
.
-
stackMallocInt
public static java.nio.IntBuffer stackMallocInt(int size)
Thread-local version ofMemoryStack.mallocInt(int)
.
-
stackCallocInt
public static java.nio.IntBuffer stackCallocInt(int size)
Thread-local version ofMemoryStack.callocInt(int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x)
Thread-local version ofMemoryStack.ints(int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y)
Thread-local version ofMemoryStack.ints(int, int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y, int z)
Thread-local version ofMemoryStack.ints(int, int, int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y, int z, int w)
Thread-local version ofMemoryStack.ints(int, int, int, int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int... values)
Thread-local version ofMemoryStack.ints(int...)
.
-
stackMallocLong
public static java.nio.LongBuffer stackMallocLong(int size)
Thread-local version ofMemoryStack.mallocLong(int)
.
-
stackCallocLong
public static java.nio.LongBuffer stackCallocLong(int size)
Thread-local version ofMemoryStack.callocLong(int)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x)
Thread-local version ofMemoryStack.longs(long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y)
Thread-local version ofMemoryStack.longs(long, long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y, long z)
Thread-local version ofMemoryStack.longs(long, long, long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y, long z, long w)
Thread-local version ofMemoryStack.longs(long, long, long, long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long... values)
Thread-local version ofMemoryStack.longs(long...)
.
-
stackMallocFloat
public static java.nio.FloatBuffer stackMallocFloat(int size)
Thread-local version ofMemoryStack.mallocFloat(int)
.
-
stackCallocFloat
public static java.nio.FloatBuffer stackCallocFloat(int size)
Thread-local version ofMemoryStack.callocFloat(int)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x)
Thread-local version ofMemoryStack.floats(float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y)
Thread-local version ofMemoryStack.floats(float, float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y, float z)
Thread-local version ofMemoryStack.floats(float, float, float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y, float z, float w)
Thread-local version ofMemoryStack.floats(float, float, float, float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float... values)
Thread-local version ofMemoryStack.floats(float...)
.
-
stackMallocDouble
public static java.nio.DoubleBuffer stackMallocDouble(int size)
Thread-local version ofMemoryStack.mallocDouble(int)
.
-
stackCallocDouble
public static java.nio.DoubleBuffer stackCallocDouble(int size)
Thread-local version ofMemoryStack.callocDouble(int)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x)
Thread-local version ofMemoryStack.doubles(double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y)
Thread-local version ofMemoryStack.doubles(double, double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y, double z)
Thread-local version ofMemoryStack.doubles(double, double, double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y, double z, double w)
Thread-local version ofMemoryStack.doubles(double, double, double, double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double... values)
Thread-local version ofMemoryStack.doubles(double...)
.
-
stackMallocPointer
public static PointerBuffer stackMallocPointer(int size)
Thread-local version ofMemoryStack.mallocPointer(int)
.
-
stackCallocPointer
public static PointerBuffer stackCallocPointer(int size)
Thread-local version ofMemoryStack.callocPointer(int)
.
-
stackPointers
public static PointerBuffer stackPointers(long x)
Thread-local version ofMemoryStack.pointers(long)
.
-
stackPointers
public static PointerBuffer stackPointers(long x, long y)
Thread-local version ofMemoryStack.pointers(long, long)
.
-
stackPointers
public static PointerBuffer stackPointers(long x, long y, long z)
Thread-local version ofMemoryStack.pointers(long, long, long)
.
-
stackPointers
public static PointerBuffer stackPointers(long x, long y, long z, long w)
Thread-local version ofMemoryStack.pointers(long, long, long, long)
.
-
stackPointers
public static PointerBuffer stackPointers(long... values)
Thread-local version ofMemoryStack.pointers(long...)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x)
Thread-local version ofMemoryStack.pointers(Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y)
Thread-local version ofMemoryStack.pointers(Pointer, Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y, Pointer z)
Thread-local version ofMemoryStack.pointers(Pointer, Pointer, Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y, Pointer z, Pointer w)
Thread-local version ofMemoryStack.pointers(Pointer, Pointer, Pointer, Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer... values)
Thread-local version ofMemoryStack.pointers(Pointer...)
.
-
stackASCII
public static java.nio.ByteBuffer stackASCII(java.lang.CharSequence text)
Thread-local version ofMemoryStack.ASCII(CharSequence)
.
-
stackASCII
public static java.nio.ByteBuffer stackASCII(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofMemoryStack.ASCII(CharSequence, boolean)
.
-
stackUTF8
public static java.nio.ByteBuffer stackUTF8(java.lang.CharSequence text)
Thread-local version ofMemoryStack.UTF8(CharSequence)
.
-
stackUTF8
public static java.nio.ByteBuffer stackUTF8(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofMemoryStack.UTF8(CharSequence, boolean)
.
-
stackUTF16
public static java.nio.ByteBuffer stackUTF16(java.lang.CharSequence text)
Thread-local version ofMemoryStack.UTF16(CharSequence)
.
-
stackUTF16
public static java.nio.ByteBuffer stackUTF16(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofMemoryStack.UTF16(CharSequence, boolean)
.
-
-