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.AutoCloseableAn 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.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.ByteBufferbytes(byte... values)Vararg version ofMemoryStack.malloc(int).java.nio.ByteBufferbytes(byte x)Single value version ofMemoryStack.malloc(int).java.nio.ByteBufferbytes(byte x, byte y)Two value version ofMemoryStack.malloc(int).java.nio.ByteBufferbytes(byte x, byte y, byte z)Three value version ofMemoryStack.malloc(int).java.nio.ByteBufferbytes(byte x, byte y, byte z, byte w)Four value version ofMemoryStack.malloc(int).java.nio.ByteBuffercalloc(int size)Calloc version ofMemoryStack.malloc(int).java.nio.DoubleBuffercallocDouble(int size)Double version ofMemoryStack.calloc(int).java.nio.FloatBuffercallocFloat(int size)Float version ofMemoryStack.calloc(int).java.nio.IntBuffercallocInt(int size)Int version ofMemoryStack.calloc(int).java.nio.LongBuffercallocLong(int size)Long version ofMemoryStack.calloc(int).PointerBuffercallocPointer(int size)Pointer version ofMemoryStack.calloc(int).java.nio.ShortBuffercallocShort(int size)Short version ofMemoryStack.calloc(int).voidclose()CallsMemoryStack.pop()on thisMemoryStack.static MemoryStackcreate()Creates a newMemoryStackwith the default size.static MemoryStackcreate(int size)Creates a newMemoryStackwith the specified size.java.nio.DoubleBufferdoubles(double... values)Vararg version ofMemoryStack.mallocDouble(int).java.nio.DoubleBufferdoubles(double x)Single value version ofMemoryStack.mallocDouble(int).java.nio.DoubleBufferdoubles(double x, double y)Two value version ofMemoryStack.mallocDouble(int).java.nio.DoubleBufferdoubles(double x, double y, double z)Three value version ofMemoryStack.mallocDouble(int).java.nio.DoubleBufferdoubles(double x, double y, double z, double w)Four value version ofMemoryStack.mallocDouble(int).java.nio.FloatBufferfloats(float... values)Vararg version ofMemoryStack.mallocFloat(int).java.nio.FloatBufferfloats(float x)Single value version ofMemoryStack.mallocFloat(int).java.nio.FloatBufferfloats(float x, float y)Two value version ofMemoryStack.mallocFloat(int).java.nio.FloatBufferfloats(float x, float y, float z)Three value version ofMemoryStack.mallocFloat(int).java.nio.FloatBufferfloats(float x, float y, float z, float w)Four value version ofMemoryStack.mallocFloat(int).longgetAddress()Returns the address of the backing off-heap memory.intgetFrameIndex()Returns the current frame index.intgetPointer()Returns the current stack pointer.intgetSize()Returns the size of the backing off-heap memory.java.nio.IntBufferints(int... values)Vararg version ofMemoryStack.mallocInt(int).java.nio.IntBufferints(int x)Single value version ofMemoryStack.mallocInt(int).java.nio.IntBufferints(int x, int y)Two value version ofMemoryStack.mallocInt(int).java.nio.IntBufferints(int x, int y, int z)Three value version ofMemoryStack.mallocInt(int).java.nio.IntBufferints(int x, int y, int z, int w)Four value version ofMemoryStack.mallocInt(int).java.nio.LongBufferlongs(long... more)Vararg version ofMemoryStack.mallocLong(int).java.nio.LongBufferlongs(long x)Single value version ofMemoryStack.mallocLong(int).java.nio.LongBufferlongs(long x, long y)Two value version ofMemoryStack.mallocLong(int).java.nio.LongBufferlongs(long x, long y, long z)Three value version ofMemoryStack.mallocLong(int).java.nio.LongBufferlongs(long x, long y, long z, long w)Four value version ofMemoryStack.mallocLong(int).java.nio.ByteBuffermalloc(int size)Allocates aByteBufferon the stack.java.nio.DoubleBuffermallocDouble(int size)Double version ofMemoryStack.malloc(int).java.nio.FloatBuffermallocFloat(int size)Float version ofMemoryStack.malloc(int).java.nio.IntBuffermallocInt(int size)Int version ofMemoryStack.malloc(int).java.nio.LongBuffermallocLong(int size)Long version ofMemoryStack.malloc(int).PointerBuffermallocPointer(int size)Pointer version ofMemoryStack.malloc(int).java.nio.ShortBuffermallocShort(int size)Short version ofMemoryStack.malloc(int).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.longnmalloc(int size)CallsMemoryStack.nmalloc(int, int)withalignmentequal to 1.longnmalloc(int alignment, int size)Allocates a block ofsizebytes of memory on the stack.PointerBufferpointers(long... values)Vararg version ofMemoryStack.mallocPointer(int).PointerBufferpointers(long x)Single value version ofMemoryStack.mallocPointer(int).PointerBufferpointers(long x, long y)Two value version ofMemoryStack.mallocPointer(int).PointerBufferpointers(long x, long y, long z)Three value version ofMemoryStack.mallocPointer(int).PointerBufferpointers(long x, long y, long z, long w)Four value version ofMemoryStack.mallocPointer(int).PointerBufferpointers(Pointer... values)Vararg version ofMemoryStack.mallocPointer(int).PointerBufferpointers(Pointer x)Single value version ofMemoryStack.mallocPointer(int).PointerBufferpointers(Pointer x, Pointer y)Two value version ofMemoryStack.mallocPointer(int).PointerBufferpointers(Pointer x, Pointer y, Pointer z)Three value version ofMemoryStack.mallocPointer(int).PointerBufferpointers(Pointer x, Pointer y, Pointer z, Pointer w)Four value version ofMemoryStack.mallocPointer(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... values)Vararg version ofMemoryStack.mallocShort(int).java.nio.ShortBuffershorts(short x)Single value version ofMemoryStack.mallocShort(int).java.nio.ShortBuffershorts(short x, short y)Two value version ofMemoryStack.mallocShort(int).java.nio.ShortBuffershorts(short x, short y, short z)Three value version ofMemoryStack.mallocShort(int).java.nio.ShortBuffershorts(short x, short y, short z, short w)Four value version ofMemoryStack.mallocShort(int).static java.nio.ByteBufferstackASCII(java.lang.CharSequence text)Thread-local version ofMemoryStack.ASCII(CharSequence).static java.nio.ByteBufferstackASCII(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofMemoryStack.ASCII(CharSequence, boolean).static java.nio.ByteBufferstackBytes(byte... values)Thread-local version ofMemoryStack.bytes(byte...).static java.nio.ByteBufferstackBytes(byte x)Thread-local version ofMemoryStack.bytes(byte).static java.nio.ByteBufferstackBytes(byte x, byte y)Thread-local version ofMemoryStack.bytes(byte, byte).static java.nio.ByteBufferstackBytes(byte x, byte y, byte z)Thread-local version ofMemoryStack.bytes(byte, byte, byte).static java.nio.ByteBufferstackBytes(byte x, byte y, byte z, byte w)Thread-local version ofMemoryStack.bytes(byte, byte, byte, byte).static java.nio.ByteBufferstackCalloc(int size)Thread-local version ofMemoryStack.calloc(int).static java.nio.DoubleBufferstackCallocDouble(int size)Thread-local version ofMemoryStack.callocDouble(int).static java.nio.FloatBufferstackCallocFloat(int size)Thread-local version ofMemoryStack.callocFloat(int).static java.nio.IntBufferstackCallocInt(int size)Thread-local version ofMemoryStack.callocInt(int).static java.nio.LongBufferstackCallocLong(int size)Thread-local version ofMemoryStack.callocLong(int).static PointerBufferstackCallocPointer(int size)Thread-local version ofMemoryStack.callocPointer(int).static java.nio.ShortBufferstackCallocShort(int size)Thread-local version ofMemoryStack.callocShort(int).static java.nio.DoubleBufferstackDoubles(double... values)Thread-local version ofMemoryStack.doubles(double...).static java.nio.DoubleBufferstackDoubles(double x)Thread-local version ofMemoryStack.doubles(double).static java.nio.DoubleBufferstackDoubles(double x, double y)Thread-local version ofMemoryStack.doubles(double, double).static java.nio.DoubleBufferstackDoubles(double x, double y, double z)Thread-local version ofMemoryStack.doubles(double, double, double).static java.nio.DoubleBufferstackDoubles(double x, double y, double z, double w)Thread-local version ofMemoryStack.doubles(double, double, double, double).static java.nio.FloatBufferstackFloats(float... values)Thread-local version ofMemoryStack.floats(float...).static java.nio.FloatBufferstackFloats(float x)Thread-local version ofMemoryStack.floats(float).static java.nio.FloatBufferstackFloats(float x, float y)Thread-local version ofMemoryStack.floats(float, float).static java.nio.FloatBufferstackFloats(float x, float y, float z)Thread-local version ofMemoryStack.floats(float, float, float).static java.nio.FloatBufferstackFloats(float x, float y, float z, float w)Thread-local version ofMemoryStack.floats(float, float, float, float).static MemoryStackstackGet()Returns the stack of the current thread.static java.nio.IntBufferstackInts(int... values)Thread-local version ofMemoryStack.ints(int...).static java.nio.IntBufferstackInts(int x)Thread-local version ofMemoryStack.ints(int).static java.nio.IntBufferstackInts(int x, int y)Thread-local version ofMemoryStack.ints(int, int).static java.nio.IntBufferstackInts(int x, int y, int z)Thread-local version ofMemoryStack.ints(int, int, int).static java.nio.IntBufferstackInts(int x, int y, int z, int w)Thread-local version ofMemoryStack.ints(int, int, int, int).static java.nio.LongBufferstackLongs(long... values)Thread-local version ofMemoryStack.longs(long...).static java.nio.LongBufferstackLongs(long x)Thread-local version ofMemoryStack.longs(long).static java.nio.LongBufferstackLongs(long x, long y)Thread-local version ofMemoryStack.longs(long, long).static java.nio.LongBufferstackLongs(long x, long y, long z)Thread-local version ofMemoryStack.longs(long, long, long).static java.nio.LongBufferstackLongs(long x, long y, long z, long w)Thread-local version ofMemoryStack.longs(long, long, long, long).static java.nio.ByteBufferstackMalloc(int size)Thread-local version ofMemoryStack.malloc(int).static java.nio.DoubleBufferstackMallocDouble(int size)Thread-local version ofMemoryStack.mallocDouble(int).static java.nio.FloatBufferstackMallocFloat(int size)Thread-local version ofMemoryStack.mallocFloat(int).static java.nio.IntBufferstackMallocInt(int size)Thread-local version ofMemoryStack.mallocInt(int).static java.nio.LongBufferstackMallocLong(int size)Thread-local version ofMemoryStack.mallocLong(int).static PointerBufferstackMallocPointer(int size)Thread-local version ofMemoryStack.mallocPointer(int).static java.nio.ShortBufferstackMallocShort(int size)Thread-local version ofMemoryStack.mallocShort(int).static PointerBufferstackPointers(long... values)Thread-local version ofMemoryStack.pointers(long...).static PointerBufferstackPointers(long x)Thread-local version ofMemoryStack.pointers(long).static PointerBufferstackPointers(long x, long y)Thread-local version ofMemoryStack.pointers(long, long).static PointerBufferstackPointers(long x, long y, long z)Thread-local version ofMemoryStack.pointers(long, long, long).static PointerBufferstackPointers(long x, long y, long z, long w)Thread-local version ofMemoryStack.pointers(long, long, long, long).static PointerBufferstackPointers(Pointer... values)Thread-local version ofMemoryStack.pointers(Pointer...).static PointerBufferstackPointers(Pointer x)Thread-local version ofMemoryStack.pointers(Pointer).static PointerBufferstackPointers(Pointer x, Pointer y)Thread-local version ofMemoryStack.pointers(Pointer, Pointer).static PointerBufferstackPointers(Pointer x, Pointer y, Pointer z)Thread-local version ofMemoryStack.pointers(Pointer, Pointer, Pointer).static PointerBufferstackPointers(Pointer x, Pointer y, Pointer z, Pointer w)Thread-local version ofMemoryStack.pointers(Pointer, Pointer, Pointer, Pointer).static MemoryStackstackPop()CallsMemoryStack.pop()on the stack of the current thread.static MemoryStackstackPush()CallsMemoryStack.push()on the stack of the current thread.static java.nio.ShortBufferstackShorts(short... values)Thread-local version ofMemoryStack.shorts(short...).static java.nio.ShortBufferstackShorts(short x)Thread-local version ofMemoryStack.shorts(short).static java.nio.ShortBufferstackShorts(short x, short y)Thread-local version ofMemoryStack.shorts(short, short).static java.nio.ShortBufferstackShorts(short x, short y, short z)Thread-local version ofMemoryStack.shorts(short, short, short).static java.nio.ShortBufferstackShorts(short x, short y, short z, short w)Thread-local version ofMemoryStack.shorts(short, short, short, short).static java.nio.ByteBufferstackUTF16(java.lang.CharSequence text)Thread-local version ofMemoryStack.UTF16(CharSequence).static java.nio.ByteBufferstackUTF16(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofMemoryStack.UTF16(CharSequence, boolean).static java.nio.ByteBufferstackUTF8(java.lang.CharSequence text)Thread-local version ofMemoryStack.UTF8(CharSequence).static java.nio.ByteBufferstackUTF8(java.lang.CharSequence text, boolean nullTerminated)Thread-local version ofMemoryStack.UTF8(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.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.
-
-
-
Method Detail
-
create
public static MemoryStack create()
Creates a newMemoryStackwith the default size.
-
create
public static MemoryStack create(int size)
Creates a newMemoryStackwith 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
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
MemoryStack.push()calls.
-
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 + pointerspoints 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)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 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 ofMemoryStack.malloc(int).
-
bytes
public java.nio.ByteBuffer bytes(byte x)
Single value version ofMemoryStack.malloc(int).
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y)Two value version ofMemoryStack.malloc(int).
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z)Three value version ofMemoryStack.malloc(int).
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z, byte w)Four value version ofMemoryStack.malloc(int).
-
bytes
public java.nio.ByteBuffer bytes(byte... values)
Vararg version ofMemoryStack.malloc(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. Iftextis 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. Iftextis 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. Iftextis 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. Iftextis 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. Iftextis 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. Iftextis 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).
-
stackCalloc
public static java.nio.ByteBuffer stackCalloc(int size)
Thread-local version ofMemoryStack.calloc(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).
-
-