Top Description Constructors Methods
org.lwjgl

public Class BufferChecks

extends Object
Class Inheritance
Imports
java.nio.*

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.

Authors
cix_foo , elias_naur
Version
$Revision$ $Id$

Constructor Summary

AccessConstructor and Description
private
BufferChecks()

Static methods only!

Method Summary

Modifier and TypeMethod and Description
public static void
checkArray(Object[] array)

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

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

public static int

Returns:

the buffer position in bytes
checkBuffer
(final Buffer
the buffer to check
buffer
,
final int
the size to check
size
)

Detects the buffer type and performs the corresponding check and also returns the buffer position in bytes.

public static void
checkBuffer(ByteBuffer buf, int size)

public static void
checkBuffer(ShortBuffer buf, int size)

public static void
checkBuffer(IntBuffer buf, int size)

public static void
checkBuffer(LongBuffer buf, int size)

public static void
checkBuffer(FloatBuffer buf, int size)

public static void
checkBuffer(DoubleBuffer buf, int size)

public static void
checkBuffer(PointerBuffer buf, int size)

public static void
checkBufferSize(Buffer
The buffer to check
buf
,
int
The minimum buffer size
size
)

Helper method to ensure a buffer is big enough to receive data from a glGet* operation.

public static void
checkDirect(ByteBuffer buf)

Helper methods to ensure a buffer is direct (and, implicitly, non-null).

public static void
public static void
public static void
public static void
public static void
public static void
public static void
checkFunctionAddress(long pointer)

Helper methods to ensure a function pointer is not-null (0)

public static void
public static void
checkNullTerminated(ByteBuffer buf)

Helper methods to ensure a ByteBuffer is null-terminated

public static void
public static void
checkNullTerminated(IntBuffer buf)

Helper method to ensure an IntBuffer is null-terminated

public static void
checkNullTerminated(LongBuffer buf)

Helper method to ensure a LongBuffer is null-terminated

public static void
checkNullTerminated(PointerBuffer buf)

Helper method to ensure a PointerBuffer is null-terminated

private static void
throwArraySizeException(Object[] array, int size)

private static void
throwArraySizeException(long[] array, int size)

private static void
throwBufferSizeException(Buffer buf, int size)

This is a separate call to help inline checkBufferSize.

private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BufferChecksback to summary
private BufferChecks()

Static methods only!

Method Detail

checkArrayback to summary
public static void checkArray(Object[] array)
checkArrayback to summary
public static void checkArray(Object[] array, int size)
checkArrayback to summary
public static void checkArray(long[] array, int size)
checkBufferback to summary
public static int checkBuffer(final Buffer buffer, final int size)

Detects the buffer type and performs the corresponding check and also returns the buffer position in bytes.

Parameters
buffer:Buffer

the buffer to check

size:int

the size to check

Returns:int

the buffer position in bytes

checkBufferback to summary
public static void checkBuffer(ByteBuffer buf, int size)
checkBufferback to summary
public static void checkBuffer(ShortBuffer buf, int size)
checkBufferback to summary
public static void checkBuffer(IntBuffer buf, int size)
checkBufferback to summary
public static void checkBuffer(LongBuffer buf, int size)
checkBufferback to summary
public static void checkBuffer(FloatBuffer buf, int size)
checkBufferback to summary
public static void checkBuffer(DoubleBuffer buf, int size)
checkBufferback to summary
public static void checkBuffer(PointerBuffer buf, int size)
checkBufferSizeback to summary
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:Buffer

The buffer to check

size:int

The minimum buffer size

checkDirectback to summary
public static void checkDirect(ByteBuffer buf)

Helper methods to ensure a buffer is direct (and, implicitly, non-null).

checkDirectback to summary
public static void checkDirect(ShortBuffer buf)
checkDirectback to summary
public static void checkDirect(IntBuffer buf)
checkDirectback to summary
public static void checkDirect(LongBuffer buf)
checkDirectback to summary
public static void checkDirect(FloatBuffer buf)
checkDirectback to summary
public static void checkDirect(DoubleBuffer buf)
checkDirectback to summary
public static void checkDirect(PointerBuffer buf)
checkFunctionAddressback to summary
public static void checkFunctionAddress(long pointer)

Helper methods to ensure a function pointer is not-null (0)

checkNotNullback to summary
public static void checkNotNull(Object o)
checkNullTerminatedback to summary
public static void checkNullTerminated(ByteBuffer buf)

Helper methods to ensure a ByteBuffer is null-terminated

checkNullTerminatedback to summary
public static void checkNullTerminated(ByteBuffer buf, int count)
checkNullTerminatedback to summary
public static void checkNullTerminated(IntBuffer buf)

Helper method to ensure an IntBuffer is null-terminated

checkNullTerminatedback to summary
public static void checkNullTerminated(LongBuffer buf)

Helper method to ensure a LongBuffer is null-terminated

checkNullTerminatedback to summary
public static void checkNullTerminated(PointerBuffer buf)

Helper method to ensure a PointerBuffer is null-terminated

throwArraySizeExceptionback to summary
private static void throwArraySizeException(Object[] array, int size)
throwArraySizeExceptionback to summary
private static void throwArraySizeException(long[] array, int size)
throwBufferSizeExceptionback to summary
private static void throwBufferSizeException(Buffer buf, int size)

This is a separate call to help inline checkBufferSize.

throwBufferSizeExceptionback to summary
private static void throwBufferSizeException(PointerBuffer buf, int size)