org.lwjgl
Class BufferChecks

java.lang.Object
  extended by org.lwjgl.BufferChecks

public class BufferChecks
extends java.lang.Object

A class to check buffer boundaries in general. If there is unsufficient space in the buffer when the call is made then a buffer overflow would otherwise occur and cause unexpected behaviour, a crash, or worse, a security risk. Internal class, don't use.

Version:
$Revision: 3419 $ $Id: BufferChecks.java 3419 2010-09-30 17:21:50Z spasi $
Author:
cix_foo , elias_naur

Method Summary
static void checkArray(long[] array, int size)
           
static void checkArray(java.lang.Object[] array)
           
static void checkArray(java.lang.Object[] array, int size)
           
static int checkBuffer(java.nio.Buffer buffer, int size)
          Detects the buffer type and performs the corresponding check and also returns the buffer position in bytes.
static void checkBuffer(java.nio.ByteBuffer buf, int size)
           
static void checkBuffer(java.nio.DoubleBuffer buf, int size)
           
static void checkBuffer(java.nio.FloatBuffer buf, int size)
           
static void checkBuffer(java.nio.IntBuffer buf, int size)
           
static void checkBuffer(java.nio.LongBuffer buf, int size)
           
static void checkBuffer(PointerBuffer buf, int size)
           
static void checkBuffer(java.nio.ShortBuffer buf, int size)
           
static void checkBufferSize(java.nio.Buffer buf, int size)
          Helper method to ensure a buffer is big enough to receive data from a glGet* operation.
static void checkDirect(java.nio.ByteBuffer buf)
          Helper methods to ensure a buffer is direct (and, implicitly, non-null).
static void checkDirect(java.nio.DoubleBuffer buf)
           
static void checkDirect(java.nio.FloatBuffer buf)
           
static void checkDirect(java.nio.IntBuffer buf)
           
static void checkDirect(java.nio.LongBuffer buf)
           
static void checkDirect(PointerBuffer buf)
           
static void checkDirect(java.nio.ShortBuffer buf)
           
static void checkFunctionAddress(long pointer)
          Helper methods to ensure a function pointer is not-null (0)
static void checkNotNull(java.lang.Object o)
           
static void checkNullTerminated(java.nio.ByteBuffer buf)
          Helper methods to ensure a ByteBuffer is null-terminated
static void checkNullTerminated(java.nio.ByteBuffer buf, int count)
           
static void checkNullTerminated(java.nio.IntBuffer buf)
          Helper method to ensure an IntBuffer is null-terminated
static void checkNullTerminated(java.nio.LongBuffer buf)
          Helper method to ensure a LongBuffer is null-terminated
static void checkNullTerminated(PointerBuffer buf)
          Helper method to ensure a PointerBuffer is null-terminated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkFunctionAddress

public static void checkFunctionAddress(long pointer)
Helper methods to ensure a function pointer is not-null (0)


checkNullTerminated

public static void checkNullTerminated(java.nio.ByteBuffer buf)
Helper methods to ensure a ByteBuffer is null-terminated


checkNullTerminated

public static void checkNullTerminated(java.nio.ByteBuffer buf,
                                       int count)

checkNullTerminated

public static void checkNullTerminated(java.nio.IntBuffer buf)
Helper method to ensure an IntBuffer is null-terminated


checkNullTerminated

public static void checkNullTerminated(java.nio.LongBuffer buf)
Helper method to ensure a LongBuffer is null-terminated


checkNullTerminated

public static void checkNullTerminated(PointerBuffer buf)
Helper method to ensure a PointerBuffer is null-terminated


checkNotNull

public static void checkNotNull(java.lang.Object o)

checkDirect

public static void checkDirect(java.nio.ByteBuffer buf)
Helper methods to ensure a buffer is direct (and, implicitly, non-null).


checkDirect

public static void checkDirect(java.nio.ShortBuffer buf)

checkDirect

public static void checkDirect(java.nio.IntBuffer buf)

checkDirect

public static void checkDirect(java.nio.LongBuffer buf)

checkDirect

public static void checkDirect(java.nio.FloatBuffer buf)

checkDirect

public static void checkDirect(java.nio.DoubleBuffer buf)

checkDirect

public static void checkDirect(PointerBuffer buf)

checkArray

public static void checkArray(java.lang.Object[] array)

checkBufferSize

public static void checkBufferSize(java.nio.Buffer buf,
                                   int size)
Helper method to ensure a buffer is big enough to receive data from a glGet* operation.

Parameters:
buf - The buffer to check
size - The minimum buffer size
Throws:
java.lang.IllegalArgumentException

checkBuffer

public static int checkBuffer(java.nio.Buffer buffer,
                              int size)
Detects the buffer type and performs the corresponding check and also returns the buffer position in bytes.

Parameters:
buffer - the buffer to check
size - the size to check
Returns:
the buffer position in bytes

checkBuffer

public static void checkBuffer(java.nio.ByteBuffer buf,
                               int size)

checkBuffer

public static void checkBuffer(java.nio.ShortBuffer buf,
                               int size)

checkBuffer

public static void checkBuffer(java.nio.IntBuffer buf,
                               int size)

checkBuffer

public static void checkBuffer(java.nio.LongBuffer buf,
                               int size)

checkBuffer

public static void checkBuffer(java.nio.FloatBuffer buf,
                               int size)

checkBuffer

public static void checkBuffer(java.nio.DoubleBuffer buf,
                               int size)

checkBuffer

public static void checkBuffer(PointerBuffer buf,
                               int size)

checkArray

public static void checkArray(java.lang.Object[] array,
                              int size)

checkArray

public static void checkArray(long[] array,
                              int size)


Copyright © 2002-2009 lwjgl.org. All Rights Reserved.