Package org.lwjgl

# Class BufferChecks

java.lang.Object
org.lwjgl.BufferChecks

public class BufferChecks extends 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$ $Id$
Author:
  cix_foo invalid input: '<'cix_foo@users.sourceforge.net>, elias_naur invalid input: '<'elias_naur@users.sourceforge.net>

## Method Summary

Modifier and Type
Method
Description
`static void`
`checkArray(long[] array, int size)`
`static void`
`checkArray(Object[] array)`
`static void`
`checkArray(Object[] array, int size)`
`static int`
`checkBuffer(Buffer buffer, int size)`
Detects the buffer type and performs the corresponding check and also returns the buffer position in bytes.
`static void`
`checkBuffer(ByteBuffer buf, int size)`
`static void`
`checkBuffer(DoubleBuffer buf, int size)`
`static void`
`checkBuffer(FloatBuffer buf, int size)`
`static void`
`checkBuffer(IntBuffer buf, int size)`
`static void`
`checkBuffer(LongBuffer buf, int size)`
`static void`
`checkBuffer(ShortBuffer buf, int size)`
`static void`
`checkBuffer(PointerBuffer buf, int size)`
`static void`
`checkBufferSize(Buffer buf, int size)`
Helper method to ensure a buffer is big enough to receive data from a glGet* operation.
`static void`
`checkDirect(ByteBuffer buf)`
Helper methods to ensure a buffer is direct (and, implicitly, non-null).
`static void`
`checkDirect(DoubleBuffer buf)`
`static void`
`checkDirect(FloatBuffer buf)`
`static void`
`checkDirect(IntBuffer buf)`
`static void`
`checkDirect(LongBuffer buf)`
`static void`
`checkDirect(ShortBuffer buf)`
`static void`
`checkDirect(PointerBuffer buf)`
`static void`
`checkFunctionAddress(long pointer)`
Helper methods to ensure a function pointer is not-null (0)
`static void`
`checkNotNull(Object o)`
`static void`
`checkNullTerminated(ByteBuffer buf)`
Helper methods to ensure a ByteBuffer is null-terminated
`static void`
`checkNullTerminated(ByteBuffer buf, int count)`
`static void`
`checkNullTerminated(IntBuffer buf)`
Helper method to ensure an IntBuffer is null-terminated
`static void`
`checkNullTerminated(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 Details

### checkFunctionAddress

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

### checkNullTerminated

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

### checkNullTerminated

public static void checkNullTerminated(ByteBuffer buf, int count)

### checkNullTerminated

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

### checkNullTerminated

public static void checkNullTerminated(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(Object o)

### checkDirect

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

### checkDirect

public static void checkDirect(ShortBuffer buf)

### checkDirect

public static void checkDirect(IntBuffer buf)

### checkDirect

public static void checkDirect(LongBuffer buf)

### checkDirect

public static void checkDirect(FloatBuffer buf)

### checkDirect

public static void checkDirect(DoubleBuffer buf)

### checkDirect

public static void checkDirect(PointerBuffer buf)

### checkArray

public static void checkArray(Object[] array)

### checkBufferSize

public static void checkBufferSize(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:
  `IllegalArgumentException`

### checkBuffer

public static int checkBuffer(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(ByteBuffer buf, int size)

### checkBuffer

public static void checkBuffer(ShortBuffer buf, int size)

### checkBuffer

public static void checkBuffer(IntBuffer buf, int size)

### checkBuffer

public static void checkBuffer(LongBuffer buf, int size)

### checkBuffer

public static void checkBuffer(FloatBuffer buf, int size)

### checkBuffer

public static void checkBuffer(DoubleBuffer buf, int size)

### checkBuffer

public static void checkBuffer(PointerBuffer buf, int size)

### checkArray

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

### checkArray

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