Package org.lwjgl

Class 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 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