Top Description Inners Fields Constructors Methods
org.lwjgl

public Class PointerBuffer

extends Object
implements Comparable
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Known Direct Subclasses
org.lwjgl.PointerBuffer.PointerBufferR
Imports
java.lang.reflect.Method, java.nio.*

This class is a container for architecture independent pointer data. The interface mirrors the NIO LongBuffer API for convenience.
Author
Spasi

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
PointerBuffer.PointerBufferR

Read-only version of PointerBuffer.

Field Summary

Modifier and TypeField and Description
private static final boolean
protected final ByteBuffer
protected final Buffer
protected final IntBuffer
protected final LongBuffer

Constructor Summary

AccessConstructor and Description
public
PointerBuffer(final int
the PointerBuffer size, in number of pointers
capacity
)

Creates a new PointerBuffer with the specified capacity.

public
PointerBuffer(final ByteBuffer
the source buffer
source
)

Creates a new PointerBuffer using the specified ByteBuffer as its pointer data source.

Method Summary

Modifier and TypeMethod and Description
public static PointerBuffer

Returns:

The new pointer buffer
allocateDirect
(int
The new buffer's capacity, in pointers
capacity
)

Allocates a new pointer buffer.

public PointerBuffer

Returns:

The new, read-only pointer buffer
asReadOnlyBuffer
()

Creates a new, read-only pointer buffer that shares this buffer's content.

public final int

Returns:

The capacity of this buffer
capacity
()

Returns this buffer's capacity.

private static void
checkBounds(int off, int len, int size)

private static void
checkSource(final ByteBuffer source)

public final PointerBuffer

Returns:

This buffer
clear
()

Clears this buffer.

public PointerBuffer

Returns:

This buffer
compact
()

Compacts this buffer  (optional operation).

public int

Returns:

A negative integer, zero, or a positive integer as this buffer is less than, equal to, or greater than the given buffer
compareTo
(Object
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this buffer to another.
public PointerBuffer

Returns:

The new pointer buffer
duplicate
()

Creates a new pointer buffer that shares this buffer's content.

public boolean

Returns:

true if, and only if, this buffer is equal to the given object
equals
(Object
The object to which this buffer is to be compared
ob
)

Overrides java.lang.Object.equals.

Tells whether or not this buffer is equal to another object.
public final PointerBuffer

Returns:

This buffer
flip
()

Flips this buffer.

public long

Returns:

The long at the buffer's current position
get
()

Relative get method.

public long

Returns:

The long at the given index
get
(int
The index from which the long will be read
index
)

Absolute get method.

public PointerBuffer

Returns:

This buffer
get
(long[]
The array into which longs are to be written
dst
,
int
The offset within the array of the first long to be written; must be non-negative and no larger than dst.length
offset
,
int
The maximum number of longs to be written to the given array; must be non-negative and no larger than dst.length - offset
length
)

Relative bulk get method.

public PointerBuffer

Returns:

This buffer
get
(long[] dst)

Relative bulk get method.

public ByteBuffer

Returns:

the pointer ByteBuffer
getBuffer
()

Returns the ByteBuffer that backs this PointerBuffer.

public static int

Returns:

The pointer size in bytes
getPointerSize
()

Returns the pointer size in bytes, based on the underlying architecture.

public int

Returns:

The current hash code of this buffer
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the current hash code of this buffer.
public final boolean

Returns:

true if, and only if, there is at least one element remaining in this buffer
hasRemaining
()

Tells whether there are any elements between the current position and the limit.

public static boolean
is64Bit()

Returns true if the underlying architecture is 64bit.

public boolean
public final int

Returns:

The limit of this buffer
limit
()

Returns this buffer's limit.

public final PointerBuffer

Returns:

This buffer
limit
(int
The new limit value; must be non-negative and no larger than this buffer's capacity
newLimit
)

Sets this buffer's limit.

public final PointerBuffer

Returns:

This buffer
mark
()

Sets this buffer's mark at its position.

protected PointerBuffer

Returns:

A new PointerBuffer instance
newInstance
(final ByteBuffer source)

This method is used in slice and duplicate instead of normal object construction, so that subclasses can return themselves.

public ByteOrder

Returns:

This buffer's byte order
order
()

Retrieves this buffer's byte order.

public final int

Returns:

The position of this buffer
position
()

Returns this buffer's position.

public final PointerBuffer

Returns:

This buffer
position
(int
The new position value; must be non-negative and no larger than the current limit
newPosition
)

Sets this buffer's position.

public final int

Returns:

The position of this buffer in bytes.
positionByte
()

Returns this buffer's position, in bytes.

public PointerBuffer

Returns:

This buffer
put
(long
The long to be written
l
)

Relative put method  (optional operation).

public PointerBuffer
put(final PointerWrapper pointer)

Convenience put that accepts PointerWrapper objects.

public static void
put(final ByteBuffer
the target ByteBuffer
target
,
long
the long value to be written
l
)

Convenience put on a target ByteBuffer.

public PointerBuffer

Returns:

This buffer
put
(int
The index at which the long will be written
index
,
long
The long value to be written
l
)

Absolute put method  (optional operation).

public PointerBuffer
put(int index, PointerWrapper pointer)

Convenience put that accepts PointerWrapper objects.

public static void
put(final ByteBuffer
the target ByteBuffer
target
,
int
the index at which the long will be written
index
,
long
the long value to be written
l
)

Convenience put on a target ByteBuffer.

public PointerBuffer

Returns:

This buffer
put
(PointerBuffer
The source buffer from which longs are to be read; must not be this buffer
src
)

Relative bulk put method  (optional operation).

public PointerBuffer

Returns:

This buffer
put
(long[]
The array from which longs are to be read
src
,
int
The offset within the array of the first long to be read; must be non-negative and no larger than array.length
offset
,
int
The number of longs to be read from the given array; must be non-negative and no larger than array.length - offset
length
)

Relative bulk put method  (optional operation).

public final PointerBuffer

Returns:

This buffer
put
(long[] src)

Relative bulk put method  (optional operation).

public final int

Returns:

The number of elements remaining in this buffer
remaining
()

Returns the number of elements between the current position and the limit.

public final int

Returns:

The number of bytes remaining in this buffer
remainingByte
()

Returns the number of bytes between the current position and the limit.

public final PointerBuffer

Returns:

This buffer
reset
()

Resets this buffer's position to the previously-marked position.

public final PointerBuffer

Returns:

This buffer
rewind
()

Rewinds this buffer.

public PointerBuffer

Returns:

The new pointer buffer
slice
()

Creates a new pointer buffer whose content is a shared subsequence of this buffer's content.

public String

Returns:

A summary string
toString
()

Overrides java.lang.Object.toString.

Returns a string summarizing the state of this buffer.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

is64Bitback to summary
private static final boolean is64Bit
pointersback to summary
protected final ByteBuffer pointers
viewback to summary
protected final Buffer view
view32back to summary
protected final IntBuffer view32
view64back to summary
protected final LongBuffer view64

Constructor Detail

PointerBufferback to summary
public PointerBuffer(final int capacity)

Creates a new PointerBuffer with the specified capacity.

Parameters
capacity:int

the PointerBuffer size, in number of pointers

PointerBufferback to summary
public PointerBuffer(final ByteBuffer source)

Creates a new PointerBuffer using the specified ByteBuffer as its pointer data source. This is useful for users that do their own memory management over a big ByteBuffer, instead of allocating many small ones.

Parameters
source:ByteBuffer

the source buffer

Method Detail

allocateDirectback to summary
public static PointerBuffer allocateDirect(int capacity)

Allocates a new pointer buffer.

The new buffer's position will be zero, its limit will be its capacity, and its mark will be undefined.

Parameters
capacity:int

The new buffer's capacity, in pointers

Returns:PointerBuffer

The new pointer buffer

Exceptions
IllegalArgumentException:
If the capacity is a negative integer
asReadOnlyBufferback to summary
public PointerBuffer asReadOnlyBuffer()

Creates a new, read-only pointer buffer that shares this buffer's content.

The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer; the new buffer itself, however, will be read-only and will not allow the shared content to be modified. The two buffers' position, limit, and mark values will be independent.

The new buffer's capacity, limit and position will be identical to those of this buffer.

If this buffer is itself read-only then this method behaves in exactly the same way as the duplicate method.

Returns:PointerBuffer

The new, read-only pointer buffer

capacityback to summary
public final int capacity()

Returns this buffer's capacity.

Returns:int

The capacity of this buffer

checkBoundsback to summary
private static void checkBounds(int off, int len, int size)
checkSourceback to summary
private static void checkSource(final ByteBuffer source)
clearback to summary
public final PointerBuffer clear()

Clears this buffer. The position is set to zero, the limit is set to the capacity, and the mark is discarded.

Invoke this method before using a sequence of channel-read or put operations to fill this buffer. For example:

buf.clear();     // Prepare buffer for reading
in.read(buf);    // Read data

This method does not actually erase the data in the buffer, but it is named as if it did because it will most often be used in situations in which that might as well be the case.

Returns:PointerBuffer

This buffer

compactback to summary
public PointerBuffer compact()

Compacts this buffer  (optional operation).

The longs between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the long at index p = position() is copied to index zero, the long at index p + 1 is copied to index one, and so forth until the long at index limit() - 1 is copied to index n = limit() - 1 - p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.

The buffer's position is set to the number of longs copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.

Returns:PointerBuffer

This buffer

Exceptions
ReadOnlyBufferException:
If this buffer is read-only
compareToback to summary
public int compareTo(Object o)

Implements java.lang.Comparable.compareTo.

Compares this buffer to another.

Two pointer buffers are compared by comparing their sequences of remaining elements lexicographically, without regard to the starting position of each sequence within its corresponding buffer.

A pointer buffer is not comparable to any other type of object.

Parameters
o:Object

Doc from java.lang.Comparable.compareTo.

the object to be compared.

Returns:int

A negative integer, zero, or a positive integer as this buffer is less than, equal to, or greater than the given buffer

duplicateback to summary
public PointerBuffer duplicate()

Creates a new pointer buffer that shares this buffer's content.

The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's capacity, limit and position will be identical to those of this buffer. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

Returns:PointerBuffer

The new pointer buffer

equalsback to summary
public boolean equals(Object ob)

Overrides java.lang.Object.equals.

Tells whether or not this buffer is equal to another object.

Two pointer buffers are equal if, and only if,

  1. They have the same element type,

  2. They have the same number of remaining elements, and

  3. The two sequences of remaining elements, considered independently of their starting positions, are pointwise equal.

A pointer buffer is not equal to any other type of object.

Parameters
ob:Object

The object to which this buffer is to be compared

Returns:boolean

true if, and only if, this buffer is equal to the given object

flipback to summary
public final PointerBuffer flip()

Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded.

After a sequence of channel-read or put operations, invoke this method to prepare for a sequence of channel-write or relative get operations. For example:

buf.put(magic);    // Prepend header
in.read(buf);      // Read data into rest of buffer
buf.flip();        // Flip buffer
out.write(buf);    // Write header + data to channel

This method is often used in conjunction with the compact method when transferring data from one place to another.

Returns:PointerBuffer

This buffer

getback to summary
public long get()

Relative get method. Reads the long at this buffer's current position, and then increments the position.

Returns:long

The long at the buffer's current position

Exceptions
BufferUnderflowException:
If the buffer's current position is not smaller than its limit
getback to summary
public long get(int index)

Absolute get method. Reads the long at the given index.

Parameters
index:int

The index from which the long will be read

Returns:long

The long at the given index

Exceptions
IndexOutOfBoundsException:
If index is negative or not smaller than the buffer's limit
getback to summary
public PointerBuffer get(long[] dst, int offset, int length)

Relative bulk get method.

This method transfers longs from this buffer into the given destination array. If there are fewer longs remaining in the buffer than are required to satisfy the request, that is, if length > remaining(), then no longs are transferred and a BufferUnderflowException is thrown.

Otherwise, this method copies length longs from this buffer into the given array, starting at the current position of this buffer and at the given offset in the array. The position of this buffer is then incremented by length.

In other words, an invocation of this method of the form src.get(dst, off, len) has exactly the same effect as the loop

    for (int i = off; i < off + len; i++)
        dst[i] = src.get(); 

except that it first checks that there are sufficient longs in this buffer and it is potentially much more efficient.

Parameters
dst:long[]

The array into which longs are to be written

offset:int

The offset within the array of the first long to be written; must be non-negative and no larger than dst.length

length:int

The maximum number of longs to be written to the given array; must be non-negative and no larger than dst.length - offset

Returns:PointerBuffer

This buffer

Exceptions
BufferUnderflowException:
If there are fewer than length longs remaining in this buffer
IndexOutOfBoundsException:
If the preconditions on the offset and length parameters do not hold
getback to summary
public PointerBuffer get(long[] dst)

Relative bulk get method.

This method transfers longs from this buffer into the given destination array. An invocation of this method of the form src.get(a) behaves in exactly the same way as the invocation

    src.get(a, 0, a.length) 
Returns:PointerBuffer

This buffer

Exceptions
BufferUnderflowException:
If there are fewer than length longs remaining in this buffer
getBufferback to summary
public ByteBuffer getBuffer()

Returns the ByteBuffer that backs this PointerBuffer.

Returns:ByteBuffer

the pointer ByteBuffer

getPointerSizeback to summary
public static int getPointerSize()

Returns the pointer size in bytes, based on the underlying architecture.

Returns:int

The pointer size in bytes

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the current hash code of this buffer.

The hash code of a pointer buffer depends only upon its remaining elements; that is, upon the elements from position() up to, and including, the element at limit() - 1.

Because buffer hash codes are content-dependent, it is inadvisable to use buffers as keys in hash maps or similar data structures unless it is known that their contents will not change.

Returns:int

The current hash code of this buffer

hasRemainingback to summary
public final boolean hasRemaining()

Tells whether there are any elements between the current position and the limit.

Returns:boolean

true if, and only if, there is at least one element remaining in this buffer

is64Bitback to summary
public static boolean is64Bit()

Returns true if the underlying architecture is 64bit.

isReadOnlyback to summary
public boolean isReadOnly()
limitback to summary
public final int limit()

Returns this buffer's limit.

Returns:int

The limit of this buffer

limitback to summary
public final PointerBuffer limit(int newLimit)

Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit. If the mark is defined and larger than the new limit then it is discarded.

Parameters
newLimit:int

The new limit value; must be non-negative and no larger than this buffer's capacity

Returns:PointerBuffer

This buffer

Exceptions
IllegalArgumentException:
If the preconditions on newLimit do not hold
markback to summary
public final PointerBuffer mark()

Sets this buffer's mark at its position.

Returns:PointerBuffer

This buffer

newInstanceback to summary
protected PointerBuffer newInstance(final ByteBuffer source)

This method is used in slice and duplicate instead of normal object construction, so that subclasses can return themselves.

Returns:PointerBuffer

A new PointerBuffer instance

orderback to summary
public ByteOrder order()

Retrieves this buffer's byte order.

The byte order of a pointer buffer created by allocation or by wrapping an existing long array is the native order of the underlying hardware. The byte order of a pointer buffer created as a view of a byte buffer is that of the byte buffer at the moment that the view is created.

Returns:ByteOrder

This buffer's byte order

positionback to summary
public final int position()

Returns this buffer's position.

Returns:int

The position of this buffer

positionback to summary
public final PointerBuffer position(int newPosition)

Sets this buffer's position. If the mark is defined and larger than the new position then it is discarded.

Parameters
newPosition:int

The new position value; must be non-negative and no larger than the current limit

Returns:PointerBuffer

This buffer

Exceptions
IllegalArgumentException:
If the preconditions on newPosition do not hold
positionByteback to summary
public final int positionByte()

Returns this buffer's position, in bytes.

Returns:int

The position of this buffer in bytes.

putback to summary
public PointerBuffer put(long l)

Relative put method  (optional operation).

Writes the given long into this buffer at the current position, and then increments the position.

Parameters
l:long

The long to be written

Returns:PointerBuffer

This buffer

Exceptions
BufferOverflowException:
If this buffer's current position is not smaller than its limit
ReadOnlyBufferException:
If this buffer is read-only
putback to summary
public PointerBuffer put(final PointerWrapper pointer)

Convenience put that accepts PointerWrapper objects.

See Also
put(long)
putback to summary
public static void put(final ByteBuffer target, long l)

Convenience put on a target ByteBuffer.

Parameters
target:ByteBuffer

the target ByteBuffer

l:long

the long value to be written

putback to summary
public PointerBuffer put(int index, long l)

Absolute put method  (optional operation).

Writes the given long into this buffer at the given index.

Parameters
index:int

The index at which the long will be written

l:long

The long value to be written

Returns:PointerBuffer

This buffer

Exceptions
IndexOutOfBoundsException:
If index is negative or not smaller than the buffer's limit
ReadOnlyBufferException:
If this buffer is read-only
putback to summary
public PointerBuffer put(int index, PointerWrapper pointer)

Convenience put that accepts PointerWrapper objects.

See Also
put(int, long)
putback to summary
public static void put(final ByteBuffer target, int index, long l)

Convenience put on a target ByteBuffer.

Parameters
target:ByteBuffer

the target ByteBuffer

index:int

the index at which the long will be written

l:long

the long value to be written

putback to summary
public PointerBuffer put(PointerBuffer src)

Relative bulk put method  (optional operation).

This method transfers the longs remaining in the given source buffer into this buffer. If there are more longs remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no longs are transferred and a BufferOverflowException is thrown.

Otherwise, this method copies n = src.remaining() longs from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

    while (src.hasRemaining())
        dst.put(src.get()); 

except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient.

Parameters
src:PointerBuffer

The source buffer from which longs are to be read; must not be this buffer

Returns:PointerBuffer

This buffer

Exceptions
BufferOverflowException:
If there is insufficient space in this buffer for the remaining longs in the source buffer
IllegalArgumentException:
If the source buffer is this buffer
ReadOnlyBufferException:
If this buffer is read-only
putback to summary
public PointerBuffer put(long[] src, int offset, int length)

Relative bulk put method  (optional operation).

This method transfers longs into this buffer from the given source array. If there are more longs to be copied from the array than remain in this buffer, that is, if length > remaining(), then no longs are transferred and a BufferOverflowException is thrown.

Otherwise, this method copies length longs from the given array into this buffer, starting at the given offset in the array and at the current position of this buffer. The position of this buffer is then incremented by length.

In other words, an invocation of this method of the form dst.put(src, off, len) has exactly the same effect as the loop

    for (int i = off; i < off + len; i++)
        dst.put(a[i]); 

except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient.

Parameters
src:long[]

The array from which longs are to be read

offset:int

The offset within the array of the first long to be read; must be non-negative and no larger than array.length

length:int

The number of longs to be read from the given array; must be non-negative and no larger than array.length - offset

Returns:PointerBuffer

This buffer

Exceptions
BufferOverflowException:
If there is insufficient space in this buffer
IndexOutOfBoundsException:
If the preconditions on the offset and length parameters do not hold
ReadOnlyBufferException:
If this buffer is read-only
putback to summary
public final PointerBuffer put(long[] src)

Relative bulk put method  (optional operation).

This method transfers the entire content of the given source long array into this buffer. An invocation of this method of the form dst.put(a) behaves in exactly the same way as the invocation

    dst.put(a, 0, a.length) 
Returns:PointerBuffer

This buffer

Exceptions
BufferOverflowException:
If there is insufficient space in this buffer
ReadOnlyBufferException:
If this buffer is read-only
remainingback to summary
public final int remaining()

Returns the number of elements between the current position and the limit.

Returns:int

The number of elements remaining in this buffer

remainingByteback to summary
public final int remainingByte()

Returns the number of bytes between the current position and the limit.

Returns:int

The number of bytes remaining in this buffer

resetback to summary
public final PointerBuffer reset()

Resets this buffer's position to the previously-marked position.

Invoking this method neither changes nor discards the mark's value.

Returns:PointerBuffer

This buffer

Exceptions
InvalidMarkException:
If the mark has not been set
rewindback to summary
public final PointerBuffer rewind()

Rewinds this buffer. The position is set to zero and the mark is discarded.

Invoke this method before a sequence of channel-write or get operations, assuming that the limit has already been set appropriately. For example:

out.write(buf);    // Write remaining data
buf.rewind();      // Rewind buffer
buf.get(array);    // Copy data into array
Returns:PointerBuffer

This buffer

sliceback to summary
public PointerBuffer slice()

Creates a new pointer buffer whose content is a shared subsequence of this buffer's content.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of longs remaining in this buffer, and its mark will be undefined. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

Returns:PointerBuffer

The new pointer buffer

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string summarizing the state of this buffer.

Returns:String

A summary string

org.lwjgl back to summary

private final Class PointerBuffer.PointerBufferR

extends PointerBuffer
Class Inheritance

Read-only version of PointerBuffer.
Author
Spasi

Field Summary

Inherited from org.lwjgl.PointerBuffer:
pointersviewview32view64

Constructor Summary

AccessConstructor and Description
pack-priv
PointerBufferR(final ByteBuffer source)

Method Summary

Modifier and TypeMethod and Description
public PointerBuffer
asReadOnlyBuffer()

Overrides org.lwjgl.PointerBuffer.asReadOnlyBuffer.

Creates a new, read-only pointer buffer that shares this buffer's content.
public PointerBuffer
compact()

Overrides org.lwjgl.PointerBuffer.compact.

Compacts this buffer  (optional operation).
public boolean
protected PointerBuffer
newInstance(final ByteBuffer source)

Overrides org.lwjgl.PointerBuffer.newInstance.

This method is used in slice and duplicate instead of normal object construction, so that subclasses can return themselves.
public PointerBuffer
put(final long
The long to be written
l
)

Overrides org.lwjgl.PointerBuffer.put.

Relative put method  (optional operation).
public PointerBuffer
put(final int
The index at which the long will be written
index
,
final long
The long value to be written
l
)

Overrides org.lwjgl.PointerBuffer.put.

Absolute put method  (optional operation).
public PointerBuffer
put(final PointerBuffer
The source buffer from which longs are to be read; must not be this buffer
src
)

Overrides org.lwjgl.PointerBuffer.put.

Relative bulk put method  (optional operation).
public PointerBuffer
put(final long[]
The array from which longs are to be read
src
,
final int
The offset within the array of the first long to be read; must be non-negative and no larger than array.length
offset
,
final int
The number of longs to be read from the given array; must be non-negative and no larger than array.length - offset
length
)

Overrides org.lwjgl.PointerBuffer.put.

Relative bulk put method  (optional operation).
Inherited from org.lwjgl.PointerBuffer:
allocateDirectcapacityclearcompareToduplicateequalsflipgetgetgetgetgetBuffergetPointerSizehashCodehasRemainingis64BitlimitlimitmarkorderpositionpositionpositionByteputputputputputremainingremainingByteresetrewindslicetoString

Constructor Detail

PointerBufferRback to summary
pack-priv PointerBufferR(final ByteBuffer source)

Method Detail

asReadOnlyBufferback to summary
public PointerBuffer asReadOnlyBuffer()

Overrides org.lwjgl.PointerBuffer.asReadOnlyBuffer.

Doc from org.lwjgl.PointerBuffer.asReadOnlyBuffer.

Creates a new, read-only pointer buffer that shares this buffer's content.

The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer; the new buffer itself, however, will be read-only and will not allow the shared content to be modified. The two buffers' position, limit, and mark values will be independent.

The new buffer's capacity, limit and position will be identical to those of this buffer.

If this buffer is itself read-only then this method behaves in exactly the same way as the duplicate method.

Returns:PointerBuffer

The new, read-only pointer buffer

compactback to summary
public PointerBuffer compact()

Overrides org.lwjgl.PointerBuffer.compact.

Doc from org.lwjgl.PointerBuffer.compact.

Compacts this buffer  (optional operation).

The longs between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the long at index p = position() is copied to index zero, the long at index p + 1 is copied to index one, and so forth until the long at index limit() - 1 is copied to index n = limit() - 1 - p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.

The buffer's position is set to the number of longs copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.

Returns:PointerBuffer

This buffer

isReadOnlyback to summary
public boolean isReadOnly()

Overrides org.lwjgl.PointerBuffer.isReadOnly.

newInstanceback to summary
protected PointerBuffer newInstance(final ByteBuffer source)

Overrides org.lwjgl.PointerBuffer.newInstance.

Doc from org.lwjgl.PointerBuffer.newInstance.

This method is used in slice and duplicate instead of normal object construction, so that subclasses can return themselves.

Returns:PointerBuffer

A new PointerBuffer instance

putback to summary
public PointerBuffer put(final long l)

Overrides org.lwjgl.PointerBuffer.put.

Doc from org.lwjgl.PointerBuffer.put.

Relative put method  (optional operation).

Writes the given long into this buffer at the current position, and then increments the position.

Parameters
l:long

The long to be written

Returns:PointerBuffer

This buffer

putback to summary
public PointerBuffer put(final int index, final long l)

Overrides org.lwjgl.PointerBuffer.put.

Doc from org.lwjgl.PointerBuffer.put.

Absolute put method  (optional operation).

Writes the given long into this buffer at the given index.

Parameters
index:int

The index at which the long will be written

l:long

The long value to be written

Returns:PointerBuffer

This buffer

putback to summary
public PointerBuffer put(final PointerBuffer src)

Overrides org.lwjgl.PointerBuffer.put.

Doc from org.lwjgl.PointerBuffer.put.

Relative bulk put method  (optional operation).

This method transfers the longs remaining in the given source buffer into this buffer. If there are more longs remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no longs are transferred and a BufferOverflowException is thrown.

Otherwise, this method copies n = src.remaining() longs from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

    while (src.hasRemaining())
        dst.put(src.get()); 

except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient.

Parameters
src:PointerBuffer

The source buffer from which longs are to be read; must not be this buffer

Returns:PointerBuffer

This buffer

putback to summary
public PointerBuffer put(final long[] src, final int offset, final int length)

Overrides org.lwjgl.PointerBuffer.put.

Doc from org.lwjgl.PointerBuffer.put.

Relative bulk put method  (optional operation).

This method transfers longs into this buffer from the given source array. If there are more longs to be copied from the array than remain in this buffer, that is, if length > remaining(), then no longs are transferred and a BufferOverflowException is thrown.

Otherwise, this method copies length longs from the given array into this buffer, starting at the given offset in the array and at the current position of this buffer. The position of this buffer is then incremented by length.

In other words, an invocation of this method of the form dst.put(src, off, len) has exactly the same effect as the loop

    for (int i = off; i < off + len; i++)
        dst.put(a[i]); 

except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient.

Parameters
src:long[]

The array from which longs are to be read

offset:int

The offset within the array of the first long to be read; must be non-negative and no larger than array.length

length:int

The number of longs to be read from the given array; must be non-negative and no larger than array.length - offset

Returns:PointerBuffer

This buffer