Class MemoryStack
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.MemoryStack
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,Pointer
public class MemoryStack extends Pointer.Default implements java.lang.AutoCloseable
An off-heap memory stack.This class should be used in a thread-local manner for stack allocations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer
Pointer.Default
-
-
Field Summary
-
Fields inherited from interface org.lwjgl.system.Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.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
ASCIISafe(java.lang.CharSequence text)
java.nio.ByteBuffer
ASCIISafe(java.lang.CharSequence text, boolean nullTerminated)
java.nio.ByteBuffer
bytes(byte x)
Single value version ofmalloc(int, int)
.java.nio.ByteBuffer
bytes(byte... values)
Vararg version ofmalloc(int, int)
.java.nio.ByteBuffer
bytes(byte x, byte y)
Two value version ofmalloc(int, int)
.java.nio.ByteBuffer
bytes(byte x, byte y, byte z)
Three value version ofmalloc(int, int)
.java.nio.ByteBuffer
bytes(byte x, byte y, byte z, byte w)
Four value version ofmalloc(int, int)
.java.nio.ByteBuffer
calloc(int size)
Calloc version ofmalloc(int)
.java.nio.ByteBuffer
calloc(int alignment, int size)
Calloc version ofmalloc(int, int)
.CLongBuffer
callocCLong(int size)
CLong version ofcalloc(int)
.java.nio.DoubleBuffer
callocDouble(int size)
Double version ofcalloc(int)
.java.nio.FloatBuffer
callocFloat(int size)
Float version ofcalloc(int)
.java.nio.IntBuffer
callocInt(int size)
Int version ofcalloc(int)
.java.nio.LongBuffer
callocLong(int size)
Long version ofcalloc(int)
.PointerBuffer
callocPointer(int size)
Pointer version ofcalloc(int)
.java.nio.ShortBuffer
callocShort(int size)
Short version ofcalloc(int)
.CLongBuffer
clongs(long x)
Single value version ofmallocCLong(int)
.CLongBuffer
clongs(long... values)
Vararg version ofmallocCLong(int)
.CLongBuffer
clongs(long x, long y)
Two value version ofmallocCLong(int)
.CLongBuffer
clongs(long x, long y, long z)
Three value version ofmallocCLong(int)
.CLongBuffer
clongs(long x, long y, long z, long w)
Four value version ofmallocCLong(int)
.void
close()
Callspop()
on thisMemoryStack
.static MemoryStack
create()
Creates a newMemoryStack
with the default size.static MemoryStack
create(int capacity)
Creates a newMemoryStack
with the specified size.static MemoryStack
create(java.nio.ByteBuffer buffer)
Creates a newMemoryStack
backed by the specified memory buffer.java.nio.DoubleBuffer
doubles(double x)
Single value version ofmallocDouble(int)
.java.nio.DoubleBuffer
doubles(double... values)
Vararg version ofmallocDouble(int)
.java.nio.DoubleBuffer
doubles(double x, double y)
Two value version ofmallocDouble(int)
.java.nio.DoubleBuffer
doubles(double x, double y, double z)
Three value version ofmallocDouble(int)
.java.nio.DoubleBuffer
doubles(double x, double y, double z, double w)
Four value version ofmallocDouble(int)
.java.nio.FloatBuffer
floats(float x)
Single value version ofmallocFloat(int)
.java.nio.FloatBuffer
floats(float... values)
Vararg version ofmallocFloat(int)
.java.nio.FloatBuffer
floats(float x, float y)
Two value version ofmallocFloat(int)
.java.nio.FloatBuffer
floats(float x, float y, float z)
Three value version ofmallocFloat(int)
.java.nio.FloatBuffer
floats(float x, float y, float z, float w)
Four value version ofmallocFloat(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.long
getPointerAddress()
Returns the memory address at the current stack pointer.int
getSize()
Returns the size of the backing off-heap memory.java.nio.IntBuffer
ints(int x)
Single value version ofmallocInt(int)
.java.nio.IntBuffer
ints(int... values)
Vararg version ofmallocInt(int)
.java.nio.IntBuffer
ints(int x, int y)
Two value version ofmallocInt(int)
.java.nio.IntBuffer
ints(int x, int y, int z)
Three value version ofmallocInt(int)
.java.nio.IntBuffer
ints(int x, int y, int z, int w)
Four value version ofmallocInt(int)
.java.nio.LongBuffer
longs(long x)
Single value version ofmallocLong(int)
.java.nio.LongBuffer
longs(long... more)
Vararg version ofmallocLong(int)
.java.nio.LongBuffer
longs(long x, long y)
Two value version ofmallocLong(int)
.java.nio.LongBuffer
longs(long x, long y, long z)
Three value version ofmallocLong(int)
.java.nio.LongBuffer
longs(long x, long y, long z, long w)
Four value version ofmallocLong(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.CLongBuffer
mallocCLong(int size)
CLong version ofmalloc(int)
.java.nio.DoubleBuffer
mallocDouble(int size)
Double version ofmalloc(int)
.java.nio.FloatBuffer
mallocFloat(int size)
Float version ofmalloc(int)
.java.nio.IntBuffer
mallocInt(int size)
Int version ofmalloc(int)
.java.nio.LongBuffer
mallocLong(int size)
Long version ofmalloc(int)
.PointerBuffer
mallocPointer(int size)
Pointer version ofmalloc(int)
.java.nio.ShortBuffer
mallocShort(int size)
Short version ofmalloc(int)
.int
nASCII(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using ASCII encoding and returns the encoded text length, in bytes.int
nASCIISafe(java.lang.CharSequence text, boolean nullTerminated)
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.static MemoryStack
ncreate(long address, int size)
Creates a newMemoryStack
backed by the specified memory region.long
nmalloc(int size)
Callsnmalloc(int, int)
withalignment
equal to 1.long
nmalloc(int alignment, int size)
Allocates a block ofsize
bytes of memory on the stack.static long
nstackCalloc(int alignment, int num, int size)
Thread-local version ofncalloc(int, int, int)
.static long
nstackMalloc(int size)
Thread-local version ofnmalloc(int)
.static long
nstackMalloc(int alignment, int size)
Thread-local version ofnmalloc(int, int)
.int
nUTF16(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using UTF16 encoding and returns the encoded text length, in bytes.int
nUTF16Safe(java.lang.CharSequence text, boolean nullTerminated)
int
nUTF8(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using UTF8 encoding and returns the encoded text length, in bytes.int
nUTF8Safe(java.lang.CharSequence text, boolean nullTerminated)
PointerBuffer
pointers(long x)
Single value version ofmallocPointer(int)
.PointerBuffer
pointers(long... values)
Vararg version ofmallocPointer(int)
.PointerBuffer
pointers(long x, long y)
Two value version ofmallocPointer(int)
.PointerBuffer
pointers(long x, long y, long z)
Three value version ofmallocPointer(int)
.PointerBuffer
pointers(long x, long y, long z, long w)
Four value version ofmallocPointer(int)
.PointerBuffer
pointers(java.nio.Buffer x)
Single value version ofmallocPointer(int)
.PointerBuffer
pointers(java.nio.Buffer... values)
Vararg version ofmallocPointer(int)
.PointerBuffer
pointers(java.nio.Buffer x, java.nio.Buffer y)
Two value version ofmallocPointer(int)
.PointerBuffer
pointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z)
Three value version ofmallocPointer(int)
.PointerBuffer
pointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z, java.nio.Buffer w)
Four value version ofmallocPointer(int)
.PointerBuffer
pointers(Pointer x)
Single value version ofmallocPointer(int)
.PointerBuffer
pointers(Pointer... values)
Vararg version ofmallocPointer(int)
.PointerBuffer
pointers(Pointer x, Pointer y)
Two value version ofmallocPointer(int)
.PointerBuffer
pointers(Pointer x, Pointer y, Pointer z)
Three value version ofmallocPointer(int)
.PointerBuffer
pointers(Pointer x, Pointer y, Pointer z, Pointer w)
Four value version ofmallocPointer(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 x)
Single value version ofmallocShort(int)
.java.nio.ShortBuffer
shorts(short... values)
Vararg version ofmallocShort(int)
.java.nio.ShortBuffer
shorts(short x, short y)
Two value version ofmallocShort(int)
.java.nio.ShortBuffer
shorts(short x, short y, short z)
Three value version ofmallocShort(int)
.java.nio.ShortBuffer
shorts(short x, short y, short z, short w)
Four value version ofmallocShort(int)
.static java.nio.ByteBuffer
stackASCII(java.lang.CharSequence text)
Thread-local version ofASCII(CharSequence)
.static java.nio.ByteBuffer
stackASCII(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofASCII(CharSequence, boolean)
.static java.nio.ByteBuffer
stackASCIISafe(java.lang.CharSequence text)
Thread-local version ofASCII(CharSequence)
.static java.nio.ByteBuffer
stackASCIISafe(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofASCII(CharSequence, boolean)
.static java.nio.ByteBuffer
stackBytes(byte x)
Thread-local version ofbytes(byte)
.static java.nio.ByteBuffer
stackBytes(byte... values)
Thread-local version ofbytes(byte...)
.static java.nio.ByteBuffer
stackBytes(byte x, byte y)
Thread-local version ofbytes(byte, byte)
.static java.nio.ByteBuffer
stackBytes(byte x, byte y, byte z)
Thread-local version ofbytes(byte, byte, byte)
.static java.nio.ByteBuffer
stackBytes(byte x, byte y, byte z, byte w)
Thread-local version ofbytes(byte, byte, byte, byte)
.static java.nio.ByteBuffer
stackCalloc(int size)
Thread-local version ofcalloc(int, int)
.static CLongBuffer
stackCallocCLong(int size)
Thread-local version ofcallocCLong(int)
.static java.nio.DoubleBuffer
stackCallocDouble(int size)
Thread-local version ofcallocDouble(int)
.static java.nio.FloatBuffer
stackCallocFloat(int size)
Thread-local version ofcallocFloat(int)
.static java.nio.IntBuffer
stackCallocInt(int size)
Thread-local version ofcallocInt(int)
.static java.nio.LongBuffer
stackCallocLong(int size)
Thread-local version ofcallocLong(int)
.static PointerBuffer
stackCallocPointer(int size)
Thread-local version ofcallocPointer(int)
.static java.nio.ShortBuffer
stackCallocShort(int size)
Thread-local version ofcallocShort(int)
.static CLongBuffer
stackCLongs(long x)
Thread-local version oflongs(long)
.static CLongBuffer
stackCLongs(long... values)
Thread-local version oflongs(long...)
.static CLongBuffer
stackCLongs(long x, long y)
Thread-local version oflongs(long, long)
.static CLongBuffer
stackCLongs(long x, long y, long z)
Thread-local version oflongs(long, long, long)
.static CLongBuffer
stackCLongs(long x, long y, long z, long w)
Thread-local version oflongs(long, long, long, long)
.static java.nio.DoubleBuffer
stackDoubles(double x)
Thread-local version ofdoubles(double)
.static java.nio.DoubleBuffer
stackDoubles(double... values)
Thread-local version ofdoubles(double...)
.static java.nio.DoubleBuffer
stackDoubles(double x, double y)
Thread-local version ofdoubles(double, double)
.static java.nio.DoubleBuffer
stackDoubles(double x, double y, double z)
Thread-local version ofdoubles(double, double, double)
.static java.nio.DoubleBuffer
stackDoubles(double x, double y, double z, double w)
Thread-local version ofdoubles(double, double, double, double)
.static java.nio.FloatBuffer
stackFloats(float x)
Thread-local version offloats(float)
.static java.nio.FloatBuffer
stackFloats(float... values)
Thread-local version offloats(float...)
.static java.nio.FloatBuffer
stackFloats(float x, float y)
Thread-local version offloats(float, float)
.static java.nio.FloatBuffer
stackFloats(float x, float y, float z)
Thread-local version offloats(float, float, float)
.static java.nio.FloatBuffer
stackFloats(float x, float y, float z, float w)
Thread-local version offloats(float, float, float, float)
.static MemoryStack
stackGet()
Returns the stack of the current thread.static java.nio.IntBuffer
stackInts(int x)
Thread-local version ofints(int)
.static java.nio.IntBuffer
stackInts(int... values)
Thread-local version ofints(int...)
.static java.nio.IntBuffer
stackInts(int x, int y)
Thread-local version ofints(int, int)
.static java.nio.IntBuffer
stackInts(int x, int y, int z)
Thread-local version ofints(int, int, int)
.static java.nio.IntBuffer
stackInts(int x, int y, int z, int w)
Thread-local version ofints(int, int, int, int)
.static java.nio.LongBuffer
stackLongs(long x)
Thread-local version oflongs(long)
.static java.nio.LongBuffer
stackLongs(long... values)
Thread-local version oflongs(long...)
.static java.nio.LongBuffer
stackLongs(long x, long y)
Thread-local version oflongs(long, long)
.static java.nio.LongBuffer
stackLongs(long x, long y, long z)
Thread-local version oflongs(long, long, long)
.static java.nio.LongBuffer
stackLongs(long x, long y, long z, long w)
Thread-local version oflongs(long, long, long, long)
.static java.nio.ByteBuffer
stackMalloc(int size)
Thread-local version ofmalloc(int, int)
.static CLongBuffer
stackMallocCLong(int size)
Thread-local version ofmallocCLong(int)
.static java.nio.DoubleBuffer
stackMallocDouble(int size)
Thread-local version ofmallocDouble(int)
.static java.nio.FloatBuffer
stackMallocFloat(int size)
Thread-local version ofmallocFloat(int)
.static java.nio.IntBuffer
stackMallocInt(int size)
Thread-local version ofmallocInt(int)
.static java.nio.LongBuffer
stackMallocLong(int size)
Thread-local version ofmallocLong(int)
.static PointerBuffer
stackMallocPointer(int size)
Thread-local version ofmallocPointer(int)
.static java.nio.ShortBuffer
stackMallocShort(int size)
Thread-local version ofmallocShort(int)
.static PointerBuffer
stackPointers(long x)
Thread-local version ofpointers(long)
.static PointerBuffer
stackPointers(long... values)
Thread-local version ofpointers(long...)
.static PointerBuffer
stackPointers(long x, long y)
Thread-local version ofpointers(long, long)
.static PointerBuffer
stackPointers(long x, long y, long z)
Thread-local version ofpointers(long, long, long)
.static PointerBuffer
stackPointers(long x, long y, long z, long w)
Thread-local version ofpointers(long, long, long, long)
.static PointerBuffer
stackPointers(Pointer x)
Thread-local version ofpointers(Pointer)
.static PointerBuffer
stackPointers(Pointer... values)
Thread-local version ofpointers(Pointer...)
.static PointerBuffer
stackPointers(Pointer x, Pointer y)
Thread-local version ofpointers(Pointer, Pointer)
.static PointerBuffer
stackPointers(Pointer x, Pointer y, Pointer z)
Thread-local version ofpointers(Pointer, Pointer, Pointer)
.static PointerBuffer
stackPointers(Pointer x, Pointer y, Pointer z, Pointer w)
Thread-local version ofpointers(Pointer, Pointer, Pointer, Pointer)
.static MemoryStack
stackPop()
Callspop()
on the stack of the current thread.static MemoryStack
stackPush()
Callspush()
on the stack of the current thread.static java.nio.ShortBuffer
stackShorts(short x)
Thread-local version ofshorts(short)
.static java.nio.ShortBuffer
stackShorts(short... values)
Thread-local version ofshorts(short...)
.static java.nio.ShortBuffer
stackShorts(short x, short y)
Thread-local version ofshorts(short, short)
.static java.nio.ShortBuffer
stackShorts(short x, short y, short z)
Thread-local version ofshorts(short, short, short)
.static java.nio.ShortBuffer
stackShorts(short x, short y, short z, short w)
Thread-local version ofshorts(short, short, short, short)
.static java.nio.ByteBuffer
stackUTF16(java.lang.CharSequence text)
Thread-local version ofUTF16(CharSequence)
.static java.nio.ByteBuffer
stackUTF16(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF16(CharSequence, boolean)
.static java.nio.ByteBuffer
stackUTF16Safe(java.lang.CharSequence text)
Thread-local version ofUTF16(CharSequence)
.static java.nio.ByteBuffer
stackUTF16Safe(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF16(CharSequence, boolean)
.static java.nio.ByteBuffer
stackUTF8(java.lang.CharSequence text)
Thread-local version ofUTF8(CharSequence)
.static java.nio.ByteBuffer
stackUTF8(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF8(CharSequence, boolean)
.static java.nio.ByteBuffer
stackUTF8Safe(java.lang.CharSequence text)
Thread-local version ofUTF8(CharSequence)
.static java.nio.ByteBuffer
stackUTF8Safe(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF8(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
UTF16Safe(java.lang.CharSequence text)
java.nio.ByteBuffer
UTF16Safe(java.lang.CharSequence text, boolean nullTerminated)
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.java.nio.ByteBuffer
UTF8Safe(java.lang.CharSequence text)
java.nio.ByteBuffer
UTF8Safe(java.lang.CharSequence text, boolean nullTerminated)
-
Methods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toString
-
-
-
-
Method Detail
-
create
public static MemoryStack create()
Creates a newMemoryStack
with the default size.In the initial state, there is no active stack frame. The
push()
method must be used before any allocations.
-
create
public static MemoryStack create(int capacity)
Creates a newMemoryStack
with the specified size.In the initial state, there is no active stack frame. The
push()
method must be used before any allocations.- Parameters:
capacity
- the maximum number of bytes that may be allocated on the stack
-
create
public static MemoryStack create(java.nio.ByteBuffer buffer)
Creates a newMemoryStack
backed by the specified memory buffer.In the initial state, there is no active stack frame. The
push()
method must be used before any allocations.- Parameters:
buffer
- the backing memory buffer
-
ncreate
public static MemoryStack ncreate(long address, int size)
Creates a newMemoryStack
backed by the specified memory region.In the initial state, there is no active stack frame. The
push()
method must be used before any allocations.- Parameters:
address
- the backing memory addresssize
- the backing memory size
-
push
public MemoryStack push()
Stores the current stack pointer and pushes a new frame to the stack.This method should be called when entering a method, before doing any stack allocations. When exiting a method, call the
pop()
method to restore the previous stack frame.Pairs of push/pop calls may be nested. Care must be taken to:
- match every push with a pop
- not call pop before push has been called at least once
- not nest push calls to more than the maximum supported depth
- Returns:
- this stack
-
pop
public MemoryStack pop()
Pops the current stack frame and moves the stack pointer to the end of the previous stack frame.- Returns:
- this stack
-
close
public void close()
Callspop()
on thisMemoryStack
.This method should not be used directly. It is called automatically when the
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
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
pointer
is equal tosize
. On every allocationpointer
is reduced by the allocated size (after alignment) andaddress + pointer
points to the first byte of the last allocation.Effectively, this methods returns how many more bytes may be allocated on the stack.
-
setPointer
public void setPointer(int pointer)
Sets the current stack pointer.This method directly manipulates the stack pointer. Using it irresponsibly may break the internal state of the stack. It should only be used in rare cases or in auto-generated code.
-
nmalloc
public long nmalloc(int size)
Callsnmalloc(int, int)
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 ofmalloc(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 ofmalloc(int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x)
Single value version ofmalloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y)
Two value version ofmalloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z)
Three value version ofmalloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte x, byte y, byte z, byte w)
Four value version ofmalloc(int, int)
.
-
bytes
public java.nio.ByteBuffer bytes(byte... values)
Vararg version ofmalloc(int, int)
.
-
mallocShort
public java.nio.ShortBuffer mallocShort(int size)
Short version ofmalloc(int)
.
-
callocShort
public java.nio.ShortBuffer callocShort(int size)
Short version ofcalloc(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x)
Single value version ofmallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x, short y)
Two value version ofmallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x, short y, short z)
Three value version ofmallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short x, short y, short z, short w)
Four value version ofmallocShort(int)
.
-
shorts
public java.nio.ShortBuffer shorts(short... values)
Vararg version ofmallocShort(int)
.
-
mallocInt
public java.nio.IntBuffer mallocInt(int size)
Int version ofmalloc(int)
.
-
callocInt
public java.nio.IntBuffer callocInt(int size)
Int version ofcalloc(int)
.
-
ints
public java.nio.IntBuffer ints(int x)
Single value version ofmallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int x, int y)
Two value version ofmallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int x, int y, int z)
Three value version ofmallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int x, int y, int z, int w)
Four value version ofmallocInt(int)
.
-
ints
public java.nio.IntBuffer ints(int... values)
Vararg version ofmallocInt(int)
.
-
mallocLong
public java.nio.LongBuffer mallocLong(int size)
Long version ofmalloc(int)
.
-
callocLong
public java.nio.LongBuffer callocLong(int size)
Long version ofcalloc(int)
.
-
longs
public java.nio.LongBuffer longs(long x)
Single value version ofmallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long x, long y)
Two value version ofmallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long x, long y, long z)
Three value version ofmallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long x, long y, long z, long w)
Four value version ofmallocLong(int)
.
-
longs
public java.nio.LongBuffer longs(long... more)
Vararg version ofmallocLong(int)
.
-
mallocCLong
public CLongBuffer mallocCLong(int size)
CLong version ofmalloc(int)
.
-
callocCLong
public CLongBuffer callocCLong(int size)
CLong version ofcalloc(int)
.
-
clongs
public CLongBuffer clongs(long x)
Single value version ofmallocCLong(int)
.
-
clongs
public CLongBuffer clongs(long x, long y)
Two value version ofmallocCLong(int)
.
-
clongs
public CLongBuffer clongs(long x, long y, long z)
Three value version ofmallocCLong(int)
.
-
clongs
public CLongBuffer clongs(long x, long y, long z, long w)
Four value version ofmallocCLong(int)
.
-
clongs
public CLongBuffer clongs(long... values)
Vararg version ofmallocCLong(int)
.
-
mallocFloat
public java.nio.FloatBuffer mallocFloat(int size)
Float version ofmalloc(int)
.
-
callocFloat
public java.nio.FloatBuffer callocFloat(int size)
Float version ofcalloc(int)
.
-
floats
public java.nio.FloatBuffer floats(float x)
Single value version ofmallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float x, float y)
Two value version ofmallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float x, float y, float z)
Three value version ofmallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float x, float y, float z, float w)
Four value version ofmallocFloat(int)
.
-
floats
public java.nio.FloatBuffer floats(float... values)
Vararg version ofmallocFloat(int)
.
-
mallocDouble
public java.nio.DoubleBuffer mallocDouble(int size)
Double version ofmalloc(int)
.
-
callocDouble
public java.nio.DoubleBuffer callocDouble(int size)
Double version ofcalloc(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x)
Single value version ofmallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y)
Two value version ofmallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y, double z)
Three value version ofmallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double x, double y, double z, double w)
Four value version ofmallocDouble(int)
.
-
doubles
public java.nio.DoubleBuffer doubles(double... values)
Vararg version ofmallocDouble(int)
.
-
mallocPointer
public PointerBuffer mallocPointer(int size)
Pointer version ofmalloc(int)
.
-
callocPointer
public PointerBuffer callocPointer(int size)
Pointer version ofcalloc(int)
.
-
pointers
public PointerBuffer pointers(long x)
Single value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long x, long y)
Two value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long x, long y, long z)
Three value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long x, long y, long z, long w)
Four value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(long... values)
Vararg version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x)
Single value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y)
Two value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y, Pointer z)
Three value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer x, Pointer y, Pointer z, Pointer w)
Four value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(Pointer... values)
Vararg version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(java.nio.Buffer x)
Single value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(java.nio.Buffer x, java.nio.Buffer y)
Two value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z)
Three value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(java.nio.Buffer x, java.nio.Buffer y, java.nio.Buffer z, java.nio.Buffer w)
Four value version ofmallocPointer(int)
.
-
pointers
public PointerBuffer pointers(java.nio.Buffer... values)
Vararg version ofmallocPointer(int)
.
-
ASCII
public java.nio.ByteBuffer ASCII(java.lang.CharSequence text)
Encodes the specified text on the stack using ASCII encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.- Parameters:
text
- the text to encode
-
ASCII
public java.nio.ByteBuffer ASCII(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using ASCII encoding and returns a ByteBuffer that points to the encoded text.- Parameters:
text
- the text to encodenullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
nASCII
public int nASCII(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using ASCII encoding and returns the encoded text length, in bytes.Use
getPointerAddress()
immediately after this method to get the encoded text address.- Parameters:
text
- the text to encodenullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
ASCIISafe
@Nullable public java.nio.ByteBuffer ASCIISafe(@Nullable java.lang.CharSequence text)
-
ASCIISafe
@Nullable public java.nio.ByteBuffer ASCIISafe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
nASCIISafe
public int nASCIISafe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
UTF8
public java.nio.ByteBuffer UTF8(java.lang.CharSequence text)
Encodes the specified text on the stack using UTF8 encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.- Parameters:
text
- the text to encode
-
UTF8
public java.nio.ByteBuffer UTF8(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using UTF8 encoding and returns a ByteBuffer that points to the encoded text.- Parameters:
text
- the text to encodenullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
nUTF8
public int nUTF8(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using UTF8 encoding and returns the encoded text length, in bytes.Use
getPointerAddress()
immediately after this method to get the encoded text address.- Parameters:
text
- the text to encodenullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
UTF8Safe
@Nullable public java.nio.ByteBuffer UTF8Safe(@Nullable java.lang.CharSequence text)
-
UTF8Safe
@Nullable public java.nio.ByteBuffer UTF8Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
nUTF8Safe
public int nUTF8Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
UTF16
public java.nio.ByteBuffer UTF16(java.lang.CharSequence text)
Encodes the specified text on the stack using UTF16 encoding and returns a ByteBuffer that points to the encoded text, including a null-terminator.- Parameters:
text
- the text to encode
-
UTF16
public java.nio.ByteBuffer UTF16(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using UTF16 encoding and returns a ByteBuffer that points to the encoded text.- Parameters:
text
- the text to encodenullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
nUTF16
public int nUTF16(java.lang.CharSequence text, boolean nullTerminated)
Encodes the specified text on the stack using UTF16 encoding and returns the encoded text length, in bytes.Use
getPointerAddress()
immediately after this method to get the encoded text address.- Parameters:
text
- the text to encodenullTerminated
- if true, a null-terminator is included at the end of the encoded text
-
UTF16Safe
@Nullable public java.nio.ByteBuffer UTF16Safe(@Nullable java.lang.CharSequence text)
-
UTF16Safe
@Nullable public java.nio.ByteBuffer UTF16Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
nUTF16Safe
public int nUTF16Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
-
stackGet
public static MemoryStack stackGet()
Returns the stack of the current thread.
-
stackPush
public static MemoryStack stackPush()
Callspush()
on the stack of the current thread.- Returns:
- the stack of the current thread.
-
stackPop
public static MemoryStack stackPop()
Callspop()
on the stack of the current thread.- Returns:
- the stack of the current thread.
-
nstackMalloc
public static long nstackMalloc(int size)
Thread-local version ofnmalloc(int)
.
-
nstackMalloc
public static long nstackMalloc(int alignment, int size)
Thread-local version ofnmalloc(int, int)
.
-
nstackCalloc
public static long nstackCalloc(int alignment, int num, int size)
Thread-local version ofncalloc(int, int, int)
.
-
stackMalloc
public static java.nio.ByteBuffer stackMalloc(int size)
Thread-local version ofmalloc(int, int)
.
-
stackCalloc
public static java.nio.ByteBuffer stackCalloc(int size)
Thread-local version ofcalloc(int, int)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x)
Thread-local version ofbytes(byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y)
Thread-local version ofbytes(byte, byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y, byte z)
Thread-local version ofbytes(byte, byte, byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte x, byte y, byte z, byte w)
Thread-local version ofbytes(byte, byte, byte, byte)
.
-
stackBytes
public static java.nio.ByteBuffer stackBytes(byte... values)
Thread-local version ofbytes(byte...)
.
-
stackMallocShort
public static java.nio.ShortBuffer stackMallocShort(int size)
Thread-local version ofmallocShort(int)
.
-
stackCallocShort
public static java.nio.ShortBuffer stackCallocShort(int size)
Thread-local version ofcallocShort(int)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x)
Thread-local version ofshorts(short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y)
Thread-local version ofshorts(short, short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y, short z)
Thread-local version ofshorts(short, short, short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short x, short y, short z, short w)
Thread-local version ofshorts(short, short, short, short)
.
-
stackShorts
public static java.nio.ShortBuffer stackShorts(short... values)
Thread-local version ofshorts(short...)
.
-
stackMallocInt
public static java.nio.IntBuffer stackMallocInt(int size)
Thread-local version ofmallocInt(int)
.
-
stackCallocInt
public static java.nio.IntBuffer stackCallocInt(int size)
Thread-local version ofcallocInt(int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x)
Thread-local version ofints(int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y)
Thread-local version ofints(int, int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y, int z)
Thread-local version ofints(int, int, int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int x, int y, int z, int w)
Thread-local version ofints(int, int, int, int)
.
-
stackInts
public static java.nio.IntBuffer stackInts(int... values)
Thread-local version ofints(int...)
.
-
stackMallocLong
public static java.nio.LongBuffer stackMallocLong(int size)
Thread-local version ofmallocLong(int)
.
-
stackCallocLong
public static java.nio.LongBuffer stackCallocLong(int size)
Thread-local version ofcallocLong(int)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x)
Thread-local version oflongs(long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y)
Thread-local version oflongs(long, long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y, long z)
Thread-local version oflongs(long, long, long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long x, long y, long z, long w)
Thread-local version oflongs(long, long, long, long)
.
-
stackLongs
public static java.nio.LongBuffer stackLongs(long... values)
Thread-local version oflongs(long...)
.
-
stackMallocCLong
public static CLongBuffer stackMallocCLong(int size)
Thread-local version ofmallocCLong(int)
.
-
stackCallocCLong
public static CLongBuffer stackCallocCLong(int size)
Thread-local version ofcallocCLong(int)
.
-
stackCLongs
public static CLongBuffer stackCLongs(long x)
Thread-local version oflongs(long)
.
-
stackCLongs
public static CLongBuffer stackCLongs(long x, long y)
Thread-local version oflongs(long, long)
.
-
stackCLongs
public static CLongBuffer stackCLongs(long x, long y, long z)
Thread-local version oflongs(long, long, long)
.
-
stackCLongs
public static CLongBuffer stackCLongs(long x, long y, long z, long w)
Thread-local version oflongs(long, long, long, long)
.
-
stackCLongs
public static CLongBuffer stackCLongs(long... values)
Thread-local version oflongs(long...)
.
-
stackMallocFloat
public static java.nio.FloatBuffer stackMallocFloat(int size)
Thread-local version ofmallocFloat(int)
.
-
stackCallocFloat
public static java.nio.FloatBuffer stackCallocFloat(int size)
Thread-local version ofcallocFloat(int)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x)
Thread-local version offloats(float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y)
Thread-local version offloats(float, float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y, float z)
Thread-local version offloats(float, float, float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float x, float y, float z, float w)
Thread-local version offloats(float, float, float, float)
.
-
stackFloats
public static java.nio.FloatBuffer stackFloats(float... values)
Thread-local version offloats(float...)
.
-
stackMallocDouble
public static java.nio.DoubleBuffer stackMallocDouble(int size)
Thread-local version ofmallocDouble(int)
.
-
stackCallocDouble
public static java.nio.DoubleBuffer stackCallocDouble(int size)
Thread-local version ofcallocDouble(int)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x)
Thread-local version ofdoubles(double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y)
Thread-local version ofdoubles(double, double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y, double z)
Thread-local version ofdoubles(double, double, double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double x, double y, double z, double w)
Thread-local version ofdoubles(double, double, double, double)
.
-
stackDoubles
public static java.nio.DoubleBuffer stackDoubles(double... values)
Thread-local version ofdoubles(double...)
.
-
stackMallocPointer
public static PointerBuffer stackMallocPointer(int size)
Thread-local version ofmallocPointer(int)
.
-
stackCallocPointer
public static PointerBuffer stackCallocPointer(int size)
Thread-local version ofcallocPointer(int)
.
-
stackPointers
public static PointerBuffer stackPointers(long x)
Thread-local version ofpointers(long)
.
-
stackPointers
public static PointerBuffer stackPointers(long x, long y)
Thread-local version ofpointers(long, long)
.
-
stackPointers
public static PointerBuffer stackPointers(long x, long y, long z)
Thread-local version ofpointers(long, long, long)
.
-
stackPointers
public static PointerBuffer stackPointers(long x, long y, long z, long w)
Thread-local version ofpointers(long, long, long, long)
.
-
stackPointers
public static PointerBuffer stackPointers(long... values)
Thread-local version ofpointers(long...)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x)
Thread-local version ofpointers(Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y)
Thread-local version ofpointers(Pointer, Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y, Pointer z)
Thread-local version ofpointers(Pointer, Pointer, Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer x, Pointer y, Pointer z, Pointer w)
Thread-local version ofpointers(Pointer, Pointer, Pointer, Pointer)
.
-
stackPointers
public static PointerBuffer stackPointers(Pointer... values)
Thread-local version ofpointers(Pointer...)
.
-
stackASCII
public static java.nio.ByteBuffer stackASCII(java.lang.CharSequence text)
Thread-local version ofASCII(CharSequence)
.
-
stackASCII
public static java.nio.ByteBuffer stackASCII(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofASCII(CharSequence, boolean)
.
-
stackUTF8
public static java.nio.ByteBuffer stackUTF8(java.lang.CharSequence text)
Thread-local version ofUTF8(CharSequence)
.
-
stackUTF8
public static java.nio.ByteBuffer stackUTF8(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF8(CharSequence, boolean)
.
-
stackUTF16
public static java.nio.ByteBuffer stackUTF16(java.lang.CharSequence text)
Thread-local version ofUTF16(CharSequence)
.
-
stackUTF16
public static java.nio.ByteBuffer stackUTF16(java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF16(CharSequence, boolean)
.
-
stackASCIISafe
@Nullable public static java.nio.ByteBuffer stackASCIISafe(@Nullable java.lang.CharSequence text)
Thread-local version ofASCII(CharSequence)
.
-
stackASCIISafe
@Nullable public static java.nio.ByteBuffer stackASCIISafe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofASCII(CharSequence, boolean)
.
-
stackUTF8Safe
@Nullable public static java.nio.ByteBuffer stackUTF8Safe(@Nullable java.lang.CharSequence text)
Thread-local version ofUTF8(CharSequence)
.
-
stackUTF8Safe
@Nullable public static java.nio.ByteBuffer stackUTF8Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF8(CharSequence, boolean)
.
-
stackUTF16Safe
@Nullable public static java.nio.ByteBuffer stackUTF16Safe(@Nullable java.lang.CharSequence text)
Thread-local version ofUTF16(CharSequence)
.
-
stackUTF16Safe
@Nullable public static java.nio.ByteBuffer stackUTF16Safe(@Nullable java.lang.CharSequence text, boolean nullTerminated)
Thread-local version ofUTF16(CharSequence, boolean)
.
-
-