Class MemoryStack
- All Implemented Interfaces:
AutoCloseable,Pointer
This class should be used in a thread-local manner for stack allocations.
- See Also:
-
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
Modifier and TypeMethodDescriptionASCII(CharSequence text) Encodes the specified text on the stack using ASCII encoding and returns aByteBufferthat points to the encoded text, including a null-terminator.ASCII(CharSequence text, boolean nullTerminated) Encodes the specified text on the stack using ASCII encoding and returns aByteBufferthat points to the encoded text.@Nullable ByteBufferASCIISafe(@Nullable CharSequence text) @Nullable ByteBufferASCIISafe(@Nullable CharSequence text, boolean nullTerminated) bytes(byte x) Single value version ofmalloc(int, int).bytes(byte... values) Vararg version ofmalloc(int, int).bytes(byte x, byte y) Two value version ofmalloc(int, int).bytes(byte x, byte y, byte z) Three value version ofmalloc(int, int).bytes(byte x, byte y, byte z, byte w) Four value version ofmalloc(int, int).calloc(int size) Calloc version ofmalloc(int).calloc(int alignment, int size) Calloc version ofmalloc(int, int).callocCLong(int size) CLong version ofcalloc(int).callocDouble(int size) Double version ofcalloc(int).callocFloat(int size) Float version ofcalloc(int).callocInt(int size) Int version ofcalloc(int).callocLong(int size) Long version ofcalloc(int).callocPointer(int size) Pointer version ofcalloc(int).callocShort(int size) Short version ofcalloc(int).clongs(long x) Single value version ofmallocCLong(int).clongs(long... values) Vararg version ofmallocCLong(int).clongs(long x, long y) Two value version ofmallocCLong(int).clongs(long x, long y, long z) Three value version ofmallocCLong(int).clongs(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(ByteBuffer buffer) Creates a newMemoryStackbacked by the specified memory buffer.doubles(double x) Single value version ofmallocDouble(int).doubles(double... values) Vararg version ofmallocDouble(int).doubles(double x, double y) Two value version ofmallocDouble(int).doubles(double x, double y, double z) Three value version ofmallocDouble(int).doubles(double x, double y, double z, double w) Four value version ofmallocDouble(int).floats(float x) Single value version ofmallocFloat(int).floats(float... values) Vararg version ofmallocFloat(int).floats(float x, float y) Two value version ofmallocFloat(int).floats(float x, float y, float z) Three value version ofmallocFloat(int).floats(float x, float y, float z, float w) Four value version ofmallocFloat(int).longReturns the address of the backing off-heap memory.intReturns the current frame index.intReturns the current stack pointer.longReturns the memory address at the current stack pointer.intgetSize()Returns the size of the backing off-heap memory.ints(int x) Single value version ofmallocInt(int).ints(int... values) Vararg version ofmallocInt(int).ints(int x, int y) Two value version ofmallocInt(int).ints(int x, int y, int z) Three value version ofmallocInt(int).ints(int x, int y, int z, int w) Four value version ofmallocInt(int).longs(long x) Single value version ofmallocLong(int).longs(long... more) Vararg version ofmallocLong(int).longs(long x, long y) Two value version ofmallocLong(int).longs(long x, long y, long z) Three value version ofmallocLong(int).longs(long x, long y, long z, long w) Four value version ofmallocLong(int).malloc(int size) malloc(int alignment, int size) Allocates an alignedByteBufferon the stack.mallocCLong(int size) CLong version ofmalloc(int).mallocDouble(int size) Double version ofmalloc(int).mallocFloat(int size) Float version ofmalloc(int).mallocInt(int size) Int version ofmalloc(int).mallocLong(int size) Long version ofmalloc(int).mallocPointer(int size) Pointer version ofmalloc(int).mallocShort(int size) Short version ofmalloc(int).intnASCII(CharSequence text, boolean nullTerminated) Encodes the specified text on the stack using ASCII encoding and returns the encoded text length, in bytes.intnASCIISafe(@Nullable CharSequence text, boolean nullTerminated) longnbyte(byte value) Unsafe version ofbytes(byte).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.longnclong(long value) Unsafe version ofclongs(long).static MemoryStackncreate(long address, int size) Creates a newMemoryStackbacked by the specified memory region.longndouble(double value) Unsafe version ofdoubles(double).longnfloat(float value) Unsafe version offloats(float).longnint(int value) Unsafe version ofints(int).longnlong(long value) Unsafe version oflongs(long).longnmalloc(int size) longnmalloc(int alignment, int size) Allocates a block ofsizebytes of memory on the stack.longnpointer(long value) Unsafe version ofpointers(long).longUnsafe version ofpointers(Buffer).longUnsafe version ofpointers(Pointer).longnshort(short value) Unsafe version ofshorts(short).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(CharSequence text, boolean nullTerminated) Encodes the specified text on the stack using UTF16 encoding and returns the encoded text length, in bytes.intnUTF16Safe(@Nullable CharSequence text, boolean nullTerminated) intnUTF8(CharSequence text, boolean nullTerminated) Encodes the specified text on the stack using UTF8 encoding and returns the encoded text length, in bytes.intnUTF8Safe(@Nullable CharSequence text, boolean nullTerminated) pointers(long x) Single value version ofmallocPointer(int).pointers(long... values) Vararg version ofmallocPointer(int).pointers(long x, long y) Two value version ofmallocPointer(int).pointers(long x, long y, long z) Three value version ofmallocPointer(int).pointers(long x, long y, long z, long w) Four value version ofmallocPointer(int).Single value version ofmallocPointer(int).Vararg version ofmallocPointer(int).Two value version ofmallocPointer(int).Three value version ofmallocPointer(int).Four value version ofmallocPointer(int).Single value version ofmallocPointer(int).Vararg version ofmallocPointer(int).Two value version ofmallocPointer(int).Three value version ofmallocPointer(int).Four value version ofmallocPointer(int).pointersOfElements(CustomBuffer<?> buffer) Allocates a newPointerBufferof sizebuffer.remaining()and fills it with the addresses of the values within the providedCustomBufferstarting atbuffer.position().pop()Pops the current stack frame and moves the stack pointer to the end of the previous stack frame.push()Stores the current stack pointer and pushes a new frame to the stack.voidsetPointer(int pointer) Sets the current stack pointer.shorts(short x) Single value version ofmallocShort(int).shorts(short... values) Vararg version ofmallocShort(int).shorts(short x, short y) Two value version ofmallocShort(int).shorts(short x, short y, short z) Three value version ofmallocShort(int).shorts(short x, short y, short z, short w) Four value version ofmallocShort(int).static ByteBufferstackASCII(CharSequence text) Thread-local version ofASCII(CharSequence).static ByteBufferstackASCII(CharSequence text, boolean nullTerminated) Thread-local version ofASCII(CharSequence, boolean).static @Nullable ByteBufferstackASCIISafe(@Nullable CharSequence text) Thread-local version ofASCII(CharSequence).static @Nullable ByteBufferstackASCIISafe(@Nullable CharSequence text, boolean nullTerminated) Thread-local version ofASCII(CharSequence, boolean).static ByteBufferstackBytes(byte x) Thread-local version ofbytes(byte).static ByteBufferstackBytes(byte... values) Thread-local version ofbytes(byte...).static ByteBufferstackBytes(byte x, byte y) Thread-local version ofbytes(byte, byte).static ByteBufferstackBytes(byte x, byte y, byte z) Thread-local version ofbytes(byte, byte, byte).static ByteBufferstackBytes(byte x, byte y, byte z, byte w) Thread-local version ofbytes(byte, byte, byte, byte).static ByteBufferstackCalloc(int size) Thread-local version ofcalloc.static CLongBufferstackCallocCLong(int size) Thread-local version ofcallocCLong(int).static DoubleBufferstackCallocDouble(int size) Thread-local version ofcallocDouble(int).static FloatBufferstackCallocFloat(int size) Thread-local version ofcallocFloat(int).static IntBufferstackCallocInt(int size) Thread-local version ofcallocInt(int).static LongBufferstackCallocLong(int size) Thread-local version ofcallocLong(int).static PointerBufferstackCallocPointer(int size) Thread-local version ofcallocPointer(int).static 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 DoubleBufferstackDoubles(double x) Thread-local version ofdoubles(double).static DoubleBufferstackDoubles(double... values) Thread-local version ofdoubles(double...).static DoubleBufferstackDoubles(double x, double y) Thread-local version ofdoubles(double, double).static DoubleBufferstackDoubles(double x, double y, double z) Thread-local version ofdoubles(double, double, double).static DoubleBufferstackDoubles(double x, double y, double z, double w) Thread-local version ofdoubles(double, double, double, double).static FloatBufferstackFloats(float x) Thread-local version offloats(float).static FloatBufferstackFloats(float... values) Thread-local version offloats(float...).static FloatBufferstackFloats(float x, float y) Thread-local version offloats(float, float).static FloatBufferstackFloats(float x, float y, float z) Thread-local version offloats(float, float, float).static 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 IntBufferstackInts(int x) Thread-local version ofints(int).static IntBufferstackInts(int... values) Thread-local version ofints(int...).static IntBufferstackInts(int x, int y) Thread-local version ofints(int, int).static IntBufferstackInts(int x, int y, int z) Thread-local version ofints(int, int, int).static IntBufferstackInts(int x, int y, int z, int w) Thread-local version ofints(int, int, int, int).static LongBufferstackLongs(long x) Thread-local version oflongs(long).static LongBufferstackLongs(long... values) Thread-local version oflongs(long...).static LongBufferstackLongs(long x, long y) Thread-local version oflongs(long, long).static LongBufferstackLongs(long x, long y, long z) Thread-local version oflongs(long, long, long).static LongBufferstackLongs(long x, long y, long z, long w) Thread-local version oflongs(long, long, long, long).static ByteBufferstackMalloc(int size) Thread-local version ofmalloc.static CLongBufferstackMallocCLong(int size) Thread-local version ofmallocCLong(int).static DoubleBufferstackMallocDouble(int size) Thread-local version ofmallocDouble(int).static FloatBufferstackMallocFloat(int size) Thread-local version ofmallocFloat(int).static IntBufferstackMallocInt(int size) Thread-local version ofmallocInt(int).static LongBufferstackMallocLong(int size) Thread-local version ofmallocLong(int).static PointerBufferstackMallocPointer(int size) Thread-local version ofmallocPointer(int).static 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 PointerBufferThread-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 MemoryStackCallspush()on the stack of the current thread.static ShortBufferstackShorts(short x) Thread-local version ofshorts(short).static ShortBufferstackShorts(short... values) Thread-local version ofshorts(short...).static ShortBufferstackShorts(short x, short y) Thread-local version ofshorts(short, short).static ShortBufferstackShorts(short x, short y, short z) Thread-local version ofshorts(short, short, short).static ShortBufferstackShorts(short x, short y, short z, short w) Thread-local version ofshorts(short, short, short, short).static ByteBufferstackUTF16(CharSequence text) Thread-local version ofUTF16(CharSequence).static ByteBufferstackUTF16(CharSequence text, boolean nullTerminated) Thread-local version ofUTF16(CharSequence, boolean).static @Nullable ByteBufferstackUTF16Safe(@Nullable CharSequence text) Thread-local version ofUTF16(CharSequence).static @Nullable ByteBufferstackUTF16Safe(@Nullable CharSequence text, boolean nullTerminated) Thread-local version ofUTF16(CharSequence, boolean).static ByteBufferstackUTF8(CharSequence text) Thread-local version ofUTF8(CharSequence).static ByteBufferstackUTF8(CharSequence text, boolean nullTerminated) Thread-local version ofUTF8(CharSequence, boolean).static @Nullable ByteBufferstackUTF8Safe(@Nullable CharSequence text) Thread-local version ofUTF8(CharSequence).static @Nullable ByteBufferstackUTF8Safe(@Nullable CharSequence text, boolean nullTerminated) Thread-local version ofUTF8(CharSequence, boolean).UTF16(CharSequence text) Encodes the specified text on the stack using UTF16 encoding and returns aByteBufferthat points to the encoded text, including a null-terminator.UTF16(CharSequence text, boolean nullTerminated) Encodes the specified text on the stack using UTF16 encoding and returns aByteBufferthat points to the encoded text.@Nullable ByteBufferUTF16Safe(@Nullable CharSequence text) @Nullable ByteBufferUTF16Safe(@Nullable CharSequence text, boolean nullTerminated) UTF8(CharSequence text) Encodes the specified text on the stack using UTF8 encoding and returns aByteBufferthat points to the encoded text, including a null-terminator.UTF8(CharSequence text, boolean nullTerminated) Encodes the specified text on the stack using UTF8 encoding and returns aByteBufferthat points to the encoded text.@Nullable ByteBufferUTF8Safe(@Nullable CharSequence text) @Nullable ByteBufferUTF8Safe(@Nullable CharSequence text, boolean nullTerminated) Methods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toString
-
Method Details
-
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
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
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
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
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
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 interfaceAutoCloseable
-
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) - 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
Allocates an alignedByteBufferon the stack.- Parameters:
alignment- the required buffer alignmentsize- the number of elements in the buffer- Returns:
- the allocated buffer
-
calloc
Calloc version ofmalloc(int, int). -
malloc
- Parameters:
size- the number of elements in the buffer- Returns:
- the allocated buffer
-
calloc
Calloc version ofmalloc(int). -
nbyte
public long nbyte(byte value) Unsafe version ofbytes(byte). -
bytes
Single value version ofmalloc(int, int). -
bytes
Two value version ofmalloc(int, int). -
bytes
Three value version ofmalloc(int, int). -
bytes
Four value version ofmalloc(int, int). -
bytes
Vararg version ofmalloc(int, int). -
mallocShort
Short version ofmalloc(int). -
callocShort
Short version ofcalloc(int). -
nshort
public long nshort(short value) Unsafe version ofshorts(short). -
shorts
Single value version ofmallocShort(int). -
shorts
Two value version ofmallocShort(int). -
shorts
Three value version ofmallocShort(int). -
shorts
Four value version ofmallocShort(int). -
shorts
Vararg version ofmallocShort(int). -
mallocInt
Int version ofmalloc(int). -
callocInt
Int version ofcalloc(int). -
nint
public long nint(int value) Unsafe version ofints(int). -
ints
Single value version ofmallocInt(int). -
ints
Two value version ofmallocInt(int). -
ints
Three value version ofmallocInt(int). -
ints
Four value version ofmallocInt(int). -
ints
Vararg version ofmallocInt(int). -
mallocLong
Long version ofmalloc(int). -
callocLong
Long version ofcalloc(int). -
nlong
public long nlong(long value) Unsafe version oflongs(long). -
longs
Single value version ofmallocLong(int). -
longs
Two value version ofmallocLong(int). -
longs
Three value version ofmallocLong(int). -
longs
Four value version ofmallocLong(int). -
longs
Vararg version ofmallocLong(int). -
mallocCLong
CLong version ofmalloc(int). -
callocCLong
CLong version ofcalloc(int). -
nclong
public long nclong(long value) Unsafe version ofclongs(long). -
clongs
Single value version ofmallocCLong(int). -
clongs
Two value version ofmallocCLong(int). -
clongs
Three value version ofmallocCLong(int). -
clongs
Four value version ofmallocCLong(int). -
clongs
Vararg version ofmallocCLong(int). -
mallocFloat
Float version ofmalloc(int). -
callocFloat
Float version ofcalloc(int). -
nfloat
public long nfloat(float value) Unsafe version offloats(float). -
floats
Single value version ofmallocFloat(int). -
floats
Two value version ofmallocFloat(int). -
floats
Three value version ofmallocFloat(int). -
floats
Four value version ofmallocFloat(int). -
floats
Vararg version ofmallocFloat(int). -
mallocDouble
Double version ofmalloc(int). -
callocDouble
Double version ofcalloc(int). -
ndouble
public long ndouble(double value) Unsafe version ofdoubles(double). -
doubles
Single value version ofmallocDouble(int). -
doubles
Two value version ofmallocDouble(int). -
doubles
Three value version ofmallocDouble(int). -
doubles
Four value version ofmallocDouble(int). -
doubles
Vararg version ofmallocDouble(int). -
mallocPointer
Pointer version ofmalloc(int). -
callocPointer
Pointer version ofcalloc(int). -
npointer
public long npointer(long value) Unsafe version ofpointers(long). -
pointers
Single value version ofmallocPointer(int). -
pointers
Two value version ofmallocPointer(int). -
pointers
Three value version ofmallocPointer(int). -
pointers
Four value version ofmallocPointer(int). -
pointers
Vararg version ofmallocPointer(int). -
npointer
Unsafe version ofpointers(Pointer). -
pointers
Single value version ofmallocPointer(int). -
pointers
Two value version ofmallocPointer(int). -
pointers
Three value version ofmallocPointer(int). -
pointers
Four value version ofmallocPointer(int). -
pointers
Vararg version ofmallocPointer(int). -
npointer
Unsafe version ofpointers(Buffer). -
pointers
Single value version ofmallocPointer(int). -
pointers
Two value version ofmallocPointer(int). -
pointers
Three value version ofmallocPointer(int). -
pointers
Four value version ofmallocPointer(int). -
pointers
Vararg version ofmallocPointer(int). -
pointersOfElements
Allocates a newPointerBufferof sizebuffer.remaining()and fills it with the addresses of the values within the providedCustomBufferstarting atbuffer.position().- Parameters:
buffer- theCustomBufferto obtain its element addresses of- Returns:
- a
PointerBuffercontaining the buffer's element addresses
-
ASCII
Encodes the specified text on the stack using ASCII encoding and returns aByteBufferthat points to the encoded text, including a null-terminator.The buffer will have
alignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encode
-
ASCII
Encodes the specified text on the stack using ASCII encoding and returns aByteBufferthat points to the encoded text.The buffer will have
alignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
nASCII
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, which will havealignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
ASCIISafe
-
ASCIISafe
-
nASCIISafe
-
UTF8
Encodes the specified text on the stack using UTF8 encoding and returns aByteBufferthat points to the encoded text, including a null-terminator.The buffer will have
alignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encode
-
UTF8
Encodes the specified text on the stack using UTF8 encoding and returns aByteBufferthat points to the encoded text.The buffer will have
alignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
nUTF8
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, which will havealignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
UTF8Safe
-
UTF8Safe
-
nUTF8Safe
-
UTF16
Encodes the specified text on the stack using UTF16 encoding and returns aByteBufferthat points to the encoded text, including a null-terminator.The buffer will have
alignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encode
-
UTF16
Encodes the specified text on the stack using UTF16 encoding and returns aByteBufferthat points to the encoded text.The buffer will have
alignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
nUTF16
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, which will havealignmentequal toPOINTER_SIZE.- Parameters:
text- the text to encodenullTerminated- if true, a null-terminator is included at the end of the encoded text
-
UTF16Safe
-
UTF16Safe
-
nUTF16Safe
-
stackGet
Returns the stack of the current thread. -
stackPush
Callspush()on the stack of the current thread.- Returns:
- the stack of the current thread.
-
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
Thread-local version ofmalloc. -
stackCalloc
Thread-local version ofcalloc. -
stackBytes
Thread-local version ofbytes(byte). -
stackBytes
Thread-local version ofbytes(byte, byte). -
stackBytes
Thread-local version ofbytes(byte, byte, byte). -
stackBytes
Thread-local version ofbytes(byte, byte, byte, byte). -
stackBytes
Thread-local version ofbytes(byte...). -
stackMallocShort
Thread-local version ofmallocShort(int). -
stackCallocShort
Thread-local version ofcallocShort(int). -
stackShorts
Thread-local version ofshorts(short). -
stackShorts
Thread-local version ofshorts(short, short). -
stackShorts
Thread-local version ofshorts(short, short, short). -
stackShorts
Thread-local version ofshorts(short, short, short, short). -
stackShorts
Thread-local version ofshorts(short...). -
stackMallocInt
Thread-local version ofmallocInt(int). -
stackCallocInt
Thread-local version ofcallocInt(int). -
stackInts
Thread-local version ofints(int). -
stackInts
Thread-local version ofints(int, int). -
stackInts
Thread-local version ofints(int, int, int). -
stackInts
Thread-local version ofints(int, int, int, int). -
stackInts
Thread-local version ofints(int...). -
stackMallocLong
Thread-local version ofmallocLong(int). -
stackCallocLong
Thread-local version ofcallocLong(int). -
stackLongs
Thread-local version oflongs(long). -
stackLongs
Thread-local version oflongs(long, long). -
stackLongs
Thread-local version oflongs(long, long, long). -
stackLongs
Thread-local version oflongs(long, long, long, long). -
stackLongs
Thread-local version oflongs(long...). -
stackMallocCLong
Thread-local version ofmallocCLong(int). -
stackCallocCLong
Thread-local version ofcallocCLong(int). -
stackCLongs
Thread-local version oflongs(long). -
stackCLongs
Thread-local version oflongs(long, long). -
stackCLongs
Thread-local version oflongs(long, long, long). -
stackCLongs
Thread-local version oflongs(long, long, long, long). -
stackCLongs
Thread-local version oflongs(long...). -
stackMallocFloat
Thread-local version ofmallocFloat(int). -
stackCallocFloat
Thread-local version ofcallocFloat(int). -
stackFloats
Thread-local version offloats(float). -
stackFloats
Thread-local version offloats(float, float). -
stackFloats
Thread-local version offloats(float, float, float). -
stackFloats
Thread-local version offloats(float, float, float, float). -
stackFloats
Thread-local version offloats(float...). -
stackMallocDouble
Thread-local version ofmallocDouble(int). -
stackCallocDouble
Thread-local version ofcallocDouble(int). -
stackDoubles
Thread-local version ofdoubles(double). -
stackDoubles
Thread-local version ofdoubles(double, double). -
stackDoubles
Thread-local version ofdoubles(double, double, double). -
stackDoubles
Thread-local version ofdoubles(double, double, double, double). -
stackDoubles
Thread-local version ofdoubles(double...). -
stackMallocPointer
Thread-local version ofmallocPointer(int). -
stackCallocPointer
Thread-local version ofcallocPointer(int). -
stackPointers
Thread-local version ofpointers(long). -
stackPointers
Thread-local version ofpointers(long, long). -
stackPointers
Thread-local version ofpointers(long, long, long). -
stackPointers
Thread-local version ofpointers(long, long, long, long). -
stackPointers
Thread-local version ofpointers(long...). -
stackPointers
Thread-local version ofpointers(Pointer). -
stackPointers
Thread-local version ofpointers(Pointer, Pointer). -
stackPointers
Thread-local version ofpointers(Pointer, Pointer, Pointer). -
stackPointers
Thread-local version ofpointers(Pointer, Pointer, Pointer, Pointer). -
stackPointers
Thread-local version ofpointers(Pointer...). -
stackASCII
Thread-local version ofASCII(CharSequence). -
stackASCII
Thread-local version ofASCII(CharSequence, boolean). -
stackUTF8
Thread-local version ofUTF8(CharSequence). -
stackUTF8
Thread-local version ofUTF8(CharSequence, boolean). -
stackUTF16
Thread-local version ofUTF16(CharSequence). -
stackUTF16
Thread-local version ofUTF16(CharSequence, boolean). -
stackASCIISafe
Thread-local version ofASCII(CharSequence). -
stackASCIISafe
public static @Nullable ByteBuffer stackASCIISafe(@Nullable CharSequence text, boolean nullTerminated) Thread-local version ofASCII(CharSequence, boolean). -
stackUTF8Safe
Thread-local version ofUTF8(CharSequence). -
stackUTF8Safe
public static @Nullable ByteBuffer stackUTF8Safe(@Nullable CharSequence text, boolean nullTerminated) Thread-local version ofUTF8(CharSequence, boolean). -
stackUTF16Safe
Thread-local version ofUTF16(CharSequence). -
stackUTF16Safe
public static @Nullable ByteBuffer stackUTF16Safe(@Nullable CharSequence text, boolean nullTerminated) Thread-local version ofUTF16(CharSequence, boolean).
-