Package org.lwjgl
Class MemoryUtil
- java.lang.Object
-
- org.lwjgl.MemoryUtil
-
public final class MemoryUtil extends Object
[INTERNAL USE ONLY] This class provides utility methods for passing buffers to JNI API calls.- Author:
- Spasi
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
decodeASCII(ByteBuffer buffer)
static String
decodeUTF16(ByteBuffer buffer)
static String
decodeUTF8(ByteBuffer buffer)
static ByteBuffer
encodeASCII(CharSequence text)
Returns a ByteBuffer containing the specified text ASCII encoded and null-terminated.static ByteBuffer
encodeUTF16(CharSequence text)
Returns a ByteBuffer containing the specified text UTF-16LE encoded and null-terminated.static ByteBuffer
encodeUTF8(CharSequence text)
Returns a ByteBuffer containing the specified text UTF-8 encoded and null-terminated.static long
getAddress(ByteBuffer buffer)
static long
getAddress(ByteBuffer buffer, int position)
static long
getAddress(CharBuffer buffer)
static long
getAddress(CharBuffer buffer, int position)
static long
getAddress(DoubleBuffer buffer)
static long
getAddress(DoubleBuffer buffer, int position)
static long
getAddress(FloatBuffer buffer)
static long
getAddress(FloatBuffer buffer, int position)
static long
getAddress(IntBuffer buffer)
static long
getAddress(IntBuffer buffer, int position)
static long
getAddress(LongBuffer buffer)
static long
getAddress(LongBuffer buffer, int position)
static long
getAddress(ShortBuffer buffer)
static long
getAddress(ShortBuffer buffer, int position)
static long
getAddress(PointerBuffer buffer)
static long
getAddress(PointerBuffer buffer, int position)
static long
getAddress0(Buffer buffer)
Returns the memory address of the specified buffer.static long
getAddress0(PointerBuffer buffer)
static long
getAddress0Safe(Buffer buffer)
static long
getAddress0Safe(PointerBuffer buffer)
static long
getAddressSafe(ByteBuffer buffer)
static long
getAddressSafe(ByteBuffer buffer, int position)
static long
getAddressSafe(CharBuffer buffer)
static long
getAddressSafe(CharBuffer buffer, int position)
static long
getAddressSafe(DoubleBuffer buffer)
static long
getAddressSafe(DoubleBuffer buffer, int position)
static long
getAddressSafe(FloatBuffer buffer)
static long
getAddressSafe(FloatBuffer buffer, int position)
static long
getAddressSafe(IntBuffer buffer)
static long
getAddressSafe(IntBuffer buffer, int position)
static long
getAddressSafe(LongBuffer buffer)
static long
getAddressSafe(LongBuffer buffer, int position)
static long
getAddressSafe(ShortBuffer buffer)
static long
getAddressSafe(ShortBuffer buffer, int position)
static long
getAddressSafe(PointerBuffer buffer)
static long
getAddressSafe(PointerBuffer buffer, int position)
-
-
-
Method Detail
-
getAddress0
public static long getAddress0(Buffer buffer)
Returns the memory address of the specified buffer. [INTERNAL USE ONLY]- Parameters:
buffer
- the buffer- Returns:
- the memory address
-
getAddress0Safe
public static long getAddress0Safe(Buffer buffer)
-
getAddress0
public static long getAddress0(PointerBuffer buffer)
-
getAddress0Safe
public static long getAddress0Safe(PointerBuffer buffer)
-
getAddress
public static long getAddress(ByteBuffer buffer)
-
getAddress
public static long getAddress(ByteBuffer buffer, int position)
-
getAddress
public static long getAddress(ShortBuffer buffer)
-
getAddress
public static long getAddress(ShortBuffer buffer, int position)
-
getAddress
public static long getAddress(CharBuffer buffer)
-
getAddress
public static long getAddress(CharBuffer buffer, int position)
-
getAddress
public static long getAddress(IntBuffer buffer)
-
getAddress
public static long getAddress(IntBuffer buffer, int position)
-
getAddress
public static long getAddress(FloatBuffer buffer)
-
getAddress
public static long getAddress(FloatBuffer buffer, int position)
-
getAddress
public static long getAddress(LongBuffer buffer)
-
getAddress
public static long getAddress(LongBuffer buffer, int position)
-
getAddress
public static long getAddress(DoubleBuffer buffer)
-
getAddress
public static long getAddress(DoubleBuffer buffer, int position)
-
getAddress
public static long getAddress(PointerBuffer buffer)
-
getAddress
public static long getAddress(PointerBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(ByteBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(ByteBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(ShortBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(ShortBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(CharBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(CharBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(IntBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(IntBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(FloatBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(FloatBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(LongBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(LongBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(DoubleBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(DoubleBuffer buffer, int position)
-
getAddressSafe
public static long getAddressSafe(PointerBuffer buffer)
-
getAddressSafe
public static long getAddressSafe(PointerBuffer buffer, int position)
-
encodeASCII
public static ByteBuffer encodeASCII(CharSequence text)
Returns a ByteBuffer containing the specified text ASCII encoded and null-terminated. If text is null, null is returned.- Parameters:
text
- the text to encode- Returns:
- the encoded text or null
- See Also:
String.getBytes()
-
encodeUTF8
public static ByteBuffer encodeUTF8(CharSequence text)
Returns a ByteBuffer containing the specified text UTF-8 encoded and null-terminated. If text is null, null is returned.- Parameters:
text
- the text to encode- Returns:
- the encoded text or null
- See Also:
String.getBytes()
-
encodeUTF16
public static ByteBuffer encodeUTF16(CharSequence text)
Returns a ByteBuffer containing the specified text UTF-16LE encoded and null-terminated. If text is null, null is returned.- Parameters:
text
- the text to encode- Returns:
- the encoded text
-
decodeASCII
public static String decodeASCII(ByteBuffer buffer)
-
decodeUTF8
public static String decodeUTF8(ByteBuffer buffer)
-
decodeUTF16
public static String decodeUTF16(ByteBuffer buffer)
-
-