Top Description Inners Fields Constructors Methods
org.lwjgl.system

public abstract Class StructBuffer<T extends Struct<T>, SELF extends StructBuffer<T, SELF>>

extends CustomBuffer<SELF extends StructBuffer<T, SELF>>
implements Iterable<T extends Struct<T>>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Known Direct Subclasses
org.lwjgl.system.jni.JNINativeMethod.Buffer, org.lwjgl.system.libffi.FFICIF.Buffer, org.lwjgl.system.libffi.FFIClosure.Buffer, org.lwjgl.system.libffi.FFIType.Buffer, org.lwjgl.system.linux.XDestroyWindowEvent.Buffer, org.lwjgl.system.linux.CMsghdr.Buffer, org.lwjgl.system.linux.EpollData.Buffer, org.lwjgl.system.linux.EpollEvent.Buffer, org.lwjgl.system.linux.Flock.Buffer, org.lwjgl.system.linux.FOwnerEx.Buffer, org.lwjgl.system.linux.IOVec.Buffer, org.lwjgl.system.linux.KernelTimespec.Buffer, org.lwjgl.system.linux.Msghdr.Buffer, org.lwjgl.system.linux.OpenHow.Buffer, org.lwjgl.system.linux.Sockaddr.Buffer, org.lwjgl.system.linux.Statx.Buffer, org.lwjgl.system.linux.StatxTimestamp.Buffer, org.lwjgl.system.linux.Visual.Buffer, org.lwjgl.system.linux.XAnyEvent.Buffer, org.lwjgl.system.linux.XButtonEvent.Buffer, org.lwjgl.system.linux.XCirculateEvent.Buffer, org.lwjgl.system.linux.XCirculateRequestEvent.Buffer, org.lwjgl.system.linux.XClientMessageEvent.Buffer, org.lwjgl.system.linux.XColormapEvent.Buffer, org.lwjgl.system.linux.XConfigureEvent.Buffer, org.lwjgl.system.linux.XConfigureRequestEvent.Buffer, org.lwjgl.system.linux.XCreateWindowEvent.Buffer, org.lwjgl.system.linux.XCrossingEvent.Buffer, org.lwjgl.system.linux.XErrorEvent.Buffer, org.lwjgl.system.linux.XEvent.Buffer, org.lwjgl.system.linux.XExposeEvent.Buffer, org.lwjgl.system.linux.XFocusChangeEvent.Buffer, org.lwjgl.system.linux.XGenericEvent.Buffer, org.lwjgl.system.linux.XGenericEventCookie.Buffer, org.lwjgl.system.linux.XGraphicsExposeEvent.Buffer, org.lwjgl.system.linux.XGravityEvent.Buffer, org.lwjgl.system.linux.XKeyEvent.Buffer, org.lwjgl.system.linux.XKeymapEvent.Buffer, org.lwjgl.system.linux.XMapEvent.Buffer, org.lwjgl.system.linux.XMappingEvent.Buffer, org.lwjgl.system.linux.XMapRequestEvent.Buffer, org.lwjgl.system.linux.XMotionEvent.Buffer, org.lwjgl.system.linux.XNoExposeEvent.Buffer, org.lwjgl.system.linux.XPropertyEvent.Buffer, org.lwjgl.system.linux.XReparentEvent.Buffer, org.lwjgl.system.linux.XResizeRequestEvent.Buffer, org.lwjgl.system.linux.XSelectionClearEvent.Buffer, org.lwjgl.system.linux.XSelectionEvent.Buffer, org.lwjgl.system.linux.XSelectionRequestEvent.Buffer, org.lwjgl.system.linux.XSetWindowAttributes.Buffer, org.lwjgl.system.linux.XTimeCoord.Buffer, org.lwjgl.system.linux.XUnmapEvent.Buffer, org.lwjgl.system.linux.XVisibilityEvent.Buffer, org.lwjgl.system.linux.XVisualInfo.Buffer, org.lwjgl.system.linux.liburing.IOCQRingOffsets.Buffer, org.lwjgl.system.linux.liburing.IOSQRingOffsets.Buffer, org.lwjgl.system.linux.liburing.IOURing.Buffer, org.lwjgl.system.linux.liburing.IOURingBuf.Buffer, org.lwjgl.system.linux.liburing.IOURingBufReg.Buffer, org.lwjgl.system.linux.liburing.IOURingBufRing.Buffer, org.lwjgl.system.linux.liburing.IOURingCQ.Buffer, org.lwjgl.system.linux.liburing.IOURingCQE.Buffer, org.lwjgl.system.linux.liburing.IOURingFileIndexRange.Buffer, org.lwjgl.system.linux.liburing.IOURingGeteventsArg.Buffer, org.lwjgl.system.linux.liburing.IOURingParams.Buffer, org.lwjgl.system.linux.liburing.IOURingProbe.Buffer, org.lwjgl.system.linux.liburing.IOURingProbeOp.Buffer, org.lwjgl.system.linux.liburing.IOURingRecvmsgOut.Buffer, org.lwjgl.system.linux.liburing.IOURingRestriction.Buffer, org.lwjgl.system.linux.liburing.IOURingRSRCRegister.Buffer, org.lwjgl.system.linux.liburing.IOURingRSRCUpdate.Buffer, org.lwjgl.system.linux.liburing.IOURingRSRCUpdate2.Buffer, org.lwjgl.system.linux.liburing.IOURingSQ.Buffer, org.lwjgl.system.linux.liburing.IOURingSQE.Buffer, org.lwjgl.system.linux.liburing.IOURingSyncCancelReg.Buffer, org.lwjgl.system.macosx.CGEventTapInformation.Buffer, org.lwjgl.system.macosx.CGPoint.Buffer, org.lwjgl.system.macosx.ObjCMethodDescription.Buffer, org.lwjgl.system.macosx.ObjCPropertyAttribute.Buffer, org.lwjgl.system.windows.DATA_BLOB.Buffer, org.lwjgl.system.windows.DEVMODE.Buffer, org.lwjgl.system.windows.DISPLAY_DEVICE.Buffer, org.lwjgl.system.windows.HARDWAREINPUT.Buffer, org.lwjgl.system.windows.INPUT.Buffer, org.lwjgl.system.windows.KEYBDINPUT.Buffer, org.lwjgl.system.windows.LARGE_INTEGER.Buffer, org.lwjgl.system.windows.MONITORINFOEX.Buffer, org.lwjgl.system.windows.MOUSEINPUT.Buffer, org.lwjgl.system.windows.MSG.Buffer, org.lwjgl.system.windows.PIXELFORMATDESCRIPTOR.Buffer, org.lwjgl.system.windows.POINT.Buffer, org.lwjgl.system.windows.POINTL.Buffer, org.lwjgl.system.windows.RECT.Buffer, org.lwjgl.system.windows.SECURITY_ATTRIBUTES.Buffer, org.lwjgl.system.windows.TOUCHINPUT.Buffer, org.lwjgl.system.windows.WINDOWPLACEMENT.Buffer, org.lwjgl.system.windows.WNDCLASSEX.Buffer
Imports
javax.annotation.*, java.nio.*, java.util.*, java.util.function.*, java.util.stream.*

Base class of struct custom buffers.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Inherited from org.lwjgl.system.CustomBuffer:
capacitycontainerlimitmarkposition

Constructor Summary

AccessConstructor and Description
protected
StructBuffer(ByteBuffer container, int remaining)

protected
StructBuffer(long address, ByteBuffer container, int mark, int position, int limit, int capacity)

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

This buffer
apply
(Consumer<T> consumer)

Relative apply method.

public SELF

Returns:

This buffer
apply
(int
the index where the consumer will be applied.
index
,
Consumer<T> consumer)

Absolute apply method.

private static int
check(int index, int length)

public void
forEach(Consumer<? super T>
The action to be performed for each element
action
)

Overrides default java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.
public T

Returns:

the struct at the buffer's current position
get
()

Relative get method.

public SELF

Returns:

the struct at the buffer's current position
get
(T value)

Relative get method.

public T

Returns:

the struct at the specified index
get
(int
the index from which the struct will be read
index
)

Absolute get method.

public SELF

Returns:

the struct at the specified index
get
(int
the index from which the struct will be read
index
,
T value)

Absolute get method.

protected abstract T
public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public Stream<T>
parallelStream()

Returns a parallel Stream with this struct buffer as its source.

public SELF

Returns:

This buffer
put
(T
the struct to be written
value
)

Overrides org.lwjgl.system.CustomBuffer.put.

Relative put method  (optional operation).
public SELF

Returns:

This buffer
put
(int
the index at which the struct will be written
index
,
T
the struct value to be written
value
)

Absolute put method  (optional operation).

public int
sizeof()

Implements abstract org.lwjgl.system.CustomBuffer.sizeof.

Returns the sizeof a single element in the buffer.
public Spliterator<T>
spliterator()

Overrides default java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.
public Stream<T>
stream()

Returns a sequential Stream with this struct buffer as its source.

Inherited from org.lwjgl.system.CustomBuffer:
addressaddressaddress0capacityclearcompactduplicateflipfreehasRemaininglimitlimitmarknextGetIndexnextPutIndexpositionpositionremainingresetrewindselfsliceslicetoString

Constructor Detail

StructBufferback to summary
protected StructBuffer(ByteBuffer container, int remaining)
StructBufferback to summary
protected StructBuffer(long address, ByteBuffer container, int mark, int position, int limit, int capacity)

Method Detail

applyback to summary
public SELF apply(Consumer<T> consumer)

Relative apply method.

Passes the struct at the buffer's current position to the specified Consumer, and then increments the position.

Returns:SELF

This buffer

Exceptions
BufferUnderflowException:
If the buffer's current position is not smaller than its limit
applyback to summary
public SELF apply(int index, Consumer<T> consumer)

Absolute apply method.

Passes the struct at the specified position to the specified Consumer.

Parameters
index:int

the index where the consumer will be applied.

Returns:SELF

This buffer

Exceptions
IndexOutOfBoundsException:
If index is negative or not smaller than the buffer's limit
checkback to summary
private static int check(int index, int length)
forEachback to summary
public void forEach(Consumer<? super T> action)

Overrides default java.lang.Iterable.forEach.

Doc from java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.

Parameters
action:Consumer<? super T>

The action to be performed for each element

Annotations
@Override
getback to summary
public T get()

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

The struct instance returned is a view of the buffer at the current position. Changes to this buffer's content will be visible in the struct instance and vice versa.

Returns:T

the struct at the buffer's current position

Exceptions
BufferUnderflowException:
If the buffer's current position is not smaller than its limit
getback to summary
public SELF get(T value)

Relative get method. Reads the struct data at this buffer's current position into the specified struct, and then increments the position.

Returns:SELF

the struct at the buffer's current position

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

Absolute get method. Reads the struct at the specified index.

The struct instance returned is a view of the buffer at the specified position. Changes to this buffer's content will be visible in the struct instance and vice versa.

Parameters
index:int

the index from which the struct will be read

Returns:T

the struct at the specified index

Exceptions
IndexOutOfBoundsException:
If index is negative or not smaller than the buffer's limit
getback to summary
public SELF get(int index, T value)

Absolute get method. Reads the struct data at the specified index into the specified struct.

Parameters
index:int

the index from which the struct will be read

Returns:SELF

the struct at the specified index

Exceptions
IndexOutOfBoundsException:
If index is negative or not smaller than the buffer's limit
getElementFactoryback to summary
protected abstract T getElementFactory()
iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<T>

an Iterator.

Annotations
@Override
parallelStreamback to summary
public Stream<T> parallelStream()

Returns a parallel Stream with this struct buffer as its source.

putback to summary
public SELF put(T value)

Overrides org.lwjgl.system.CustomBuffer.put.

Relative put method  (optional operation).

Writes the specified struct into this buffer at the current position, and then increments the position.

Parameters
value:T

the struct to be written

Returns:SELF

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 SELF put(int index, T value)

Absolute put method  (optional operation).

Writes the specified struct into this buffer at the specified index.

Parameters
index:int

the index at which the struct will be written

value:T

the struct value to be written

Returns:SELF

This buffer

Exceptions
IndexOutOfBoundsException:
If index is negative or not smaller than the buffer's limit
ReadOnlyBufferException:
If this buffer is read-only
sizeofback to summary
public int sizeof()

Implements abstract org.lwjgl.system.CustomBuffer.sizeof.

Doc from org.lwjgl.system.CustomBuffer.sizeof.

Returns the sizeof a single element in the buffer.

Annotations
@Override
spliteratorback to summary
public Spliterator<T> spliterator()

Overrides default java.lang.Iterable.spliterator.

Doc from java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.

Returns:Spliterator<T>

a Spliterator over the elements described by this Iterable.

Annotations
@Override
streamback to summary
public Stream<T> stream()

Returns a sequential Stream with this struct buffer as its source.

org.lwjgl.system back to summary

private Class StructBuffer.StructIterator<T extends Struct<T>>

extends Object
implements Iterator<T extends Struct<T>>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private long
private ByteBuffer
private T
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv
StructIterator(long address, ByteBuffer container, T factory, int position, int limit)

Method Summary

Modifier and TypeMethod and Description
public void
forEachRemaining(Consumer<? super T>
The action to be performed for each element
action
)

Overrides default java.util.Iterator.forEachRemaining.

Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressback to summary
private long address
containerback to summary
private ByteBuffer container
Annotations
@Nullable
factoryback to summary
private T factory
fenceback to summary
private int fence
indexback to summary
private int index

Constructor Detail

StructIteratorback to summary
pack-priv StructIterator(long address, ByteBuffer container, T factory, int position, int limit)

Method Detail

forEachRemainingback to summary
public void forEachRemaining(Consumer<? super T> action)

Overrides default java.util.Iterator.forEachRemaining.

Doc from java.util.Iterator.forEachRemaining.

Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of an iterator is unspecified if the action modifies the collection in any way (even by calling the remove method or other mutator methods of Iterator subtypes), unless an overriding class has specified a concurrent modification policy.

Subsequent behavior of an iterator is unspecified if the action throws an exception.

Parameters
action:Consumer<? super T>

The action to be performed for each element

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:T

the next element in the iteration

Annotations
@Override
org.lwjgl.system back to summary

private Class StructBuffer.StructSpliterator<T extends Struct<T>>

extends Object
implements Spliterator<T extends Struct<T>>
Class Inheritance
All Implemented Interfaces
java.util.Spliterator

Field Summary

Modifier and TypeField and Description
private long
private ByteBuffer
private T
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv
StructSpliterator(long address, ByteBuffer container, T factory, int position, int limit)

Method Summary

Modifier and TypeMethod and Description
public int
characteristics()

Implements java.util.Spliterator.characteristics.

Returns a set of characteristics of this Spliterator and its elements.
public long
estimateSize()

Implements java.util.Spliterator.estimateSize.

Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.
public void
forEachRemaining(Consumer<? super T>
The action
action
)

Overrides default java.util.Spliterator.forEachRemaining.

Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.
public Comparator<? super T>
getComparator()

Overrides default java.util.Spliterator.getComparator.

If this Spliterator's source is SORTED by a Comparator, returns that Comparator.
public boolean
tryAdvance(Consumer<? super T>
The action whose operation is performed at-most once
action
)

Implements java.util.Spliterator.tryAdvance.

If a remaining element exists: performs the given action on it, returning true; else returns false.
public Spliterator<T>
trySplit()

Implements java.util.Spliterator.trySplit.

If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressback to summary
private long address
containerback to summary
private ByteBuffer container
Annotations
@Nullable
factoryback to summary
private T factory
fenceback to summary
private int fence
indexback to summary
private int index

Constructor Detail

StructSpliteratorback to summary
pack-priv StructSpliterator(long address, ByteBuffer container, T factory, int position, int limit)

Method Detail

characteristicsback to summary
public int characteristics()

Implements java.util.Spliterator.characteristics.

Doc from java.util.Spliterator.characteristics.

Returns a set of characteristics of this Spliterator and its elements. The result is represented as ORed values from ORDERED, DISTINCT, SORTED, SIZED, NONNULL, IMMUTABLE, CONCURRENT, SUBSIZED. Repeated calls to characteristics() on a given spliterator, prior to or in-between calls to trySplit, should always return the same result.

If a Spliterator reports an inconsistent set of characteristics (either those returned from a single invocation or across multiple invocations), no guarantees can be made about any computation using this Spliterator.

Returns:int

a representation of characteristics

Annotations
@Override
estimateSizeback to summary
public long estimateSize()

Implements java.util.Spliterator.estimateSize.

Doc from java.util.Spliterator.estimateSize.

Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.

If this Spliterator is SIZED and has not yet been partially traversed or split, or this Spliterator is SUBSIZED and has not yet been partially traversed, this estimate must be an accurate count of elements that would be encountered by a complete traversal. Otherwise, this estimate may be arbitrarily inaccurate, but must decrease as specified across invocations of trySplit.

Returns:long

the estimated size, or Long.MAX_VALUE if infinite, unknown, or too expensive to compute.

Annotations
@Override
forEachRemainingback to summary
public void forEachRemaining(Consumer<? super T> action)

Overrides default java.util.Spliterator.forEachRemaining.

Doc from java.util.Spliterator.forEachRemaining.

Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception. If this Spliterator is ORDERED, actions are performed in encounter order. Exceptions thrown by the action are relayed to the caller.

Subsequent behavior of a spliterator is unspecified if the action throws an exception.

Parameters
action:Consumer<? super T>

The action

Annotations
@Override
getComparatorback to summary
public Comparator<? super T> getComparator()

Overrides default java.util.Spliterator.getComparator.

Doc from java.util.Spliterator.getComparator.

If this Spliterator's source is SORTED by a Comparator, returns that Comparator. If the source is SORTED in natural order, returns null. Otherwise, if the source is not SORTED, throws IllegalStateException.

Returns:Comparator<? super T>

a Comparator, or null if the elements are sorted in the natural order.

Annotations
@Override
tryAdvanceback to summary
public boolean tryAdvance(Consumer<? super T> action)

Implements java.util.Spliterator.tryAdvance.

Doc from java.util.Spliterator.tryAdvance.

If a remaining element exists: performs the given action on it, returning true; else returns false. If this Spliterator is ORDERED the action is performed on the next element in encounter order. Exceptions thrown by the action are relayed to the caller.

Subsequent behavior of a spliterator is unspecified if the action throws an exception.

Parameters
action:Consumer<? super T>

The action whose operation is performed at-most once

Returns:boolean

false if no remaining elements existed upon entry to this method, else true.

Annotations
@Override
trySplitback to summary
public Spliterator<T> trySplit()

Implements java.util.Spliterator.trySplit.

Doc from java.util.Spliterator.trySplit.

If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.

If this Spliterator is ORDERED, the returned Spliterator must cover a strict prefix of the elements.

Unless this Spliterator covers an infinite number of elements, repeated calls to trySplit() must eventually return null. Upon non-null return:

  • the value reported for estimateSize() before splitting, must, after splitting, be greater than or equal to estimateSize() for this and the returned Spliterator; and
  • if this Spliterator is SUBSIZED, then estimateSize() for this spliterator before splitting must be equal to the sum of estimateSize() for this and the returned Spliterator after splitting.

This method may return null for any reason, including emptiness, inability to split after traversal has commenced, data structure constraints, and efficiency considerations.

Returns:Spliterator<T>

a Spliterator covering some portion of the elements, or null if this spliterator cannot be split

Annotations
@Override
@Nullable