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 StringdecodeASCII(ByteBuffer buffer)static StringdecodeUTF16(ByteBuffer buffer)static StringdecodeUTF8(ByteBuffer buffer)static ByteBufferencodeASCII(CharSequence text)Returns a ByteBuffer containing the specified text ASCII encoded and null-terminated.static ByteBufferencodeUTF16(CharSequence text)Returns a ByteBuffer containing the specified text UTF-16LE encoded and null-terminated.static ByteBufferencodeUTF8(CharSequence text)Returns a ByteBuffer containing the specified text UTF-8 encoded and null-terminated.static longgetAddress(ByteBuffer buffer)static longgetAddress(ByteBuffer buffer, int position)static longgetAddress(CharBuffer buffer)static longgetAddress(CharBuffer buffer, int position)static longgetAddress(DoubleBuffer buffer)static longgetAddress(DoubleBuffer buffer, int position)static longgetAddress(FloatBuffer buffer)static longgetAddress(FloatBuffer buffer, int position)static longgetAddress(IntBuffer buffer)static longgetAddress(IntBuffer buffer, int position)static longgetAddress(LongBuffer buffer)static longgetAddress(LongBuffer buffer, int position)static longgetAddress(ShortBuffer buffer)static longgetAddress(ShortBuffer buffer, int position)static longgetAddress(PointerBuffer buffer)static longgetAddress(PointerBuffer buffer, int position)static longgetAddress0(Buffer buffer)Returns the memory address of the specified buffer.static longgetAddress0(PointerBuffer buffer)static longgetAddress0Safe(Buffer buffer)static longgetAddress0Safe(PointerBuffer buffer)static longgetAddressSafe(ByteBuffer buffer)static longgetAddressSafe(ByteBuffer buffer, int position)static longgetAddressSafe(CharBuffer buffer)static longgetAddressSafe(CharBuffer buffer, int position)static longgetAddressSafe(DoubleBuffer buffer)static longgetAddressSafe(DoubleBuffer buffer, int position)static longgetAddressSafe(FloatBuffer buffer)static longgetAddressSafe(FloatBuffer buffer, int position)static longgetAddressSafe(IntBuffer buffer)static longgetAddressSafe(IntBuffer buffer, int position)static longgetAddressSafe(LongBuffer buffer)static longgetAddressSafe(LongBuffer buffer, int position)static longgetAddressSafe(ShortBuffer buffer)static longgetAddressSafe(ShortBuffer buffer, int position)static longgetAddressSafe(PointerBuffer buffer)static longgetAddressSafe(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)
-
-