Package org.lwjgl.system
Class StructBuffer<T extends Struct,SELF extends StructBuffer<T,SELF>>
- java.lang.Object
-
- org.lwjgl.system.CustomBuffer<SELF>
-
- org.lwjgl.system.StructBuffer<T,SELF>
-
- All Implemented Interfaces:
- java.lang.Iterable<T>, Pointer
- Direct Known Subclasses:
- DEVMODE.Buffer, DISPLAY_DEVICE.Buffer, JNINativeMethod.Buffer, MONITORINFOEX.Buffer, MSG.Buffer, ObjCMethodDescription.Buffer, ObjCPropertyAttribute.Buffer, PIXELFORMATDESCRIPTOR.Buffer, POINT.Buffer, POINTL.Buffer, RECT.Buffer, SECURITY_ATTRIBUTES.Buffer, TOUCHINPUT.Buffer, Visual.Buffer, WINDOWPLACEMENT.Buffer, WNDCLASSEX.Buffer, XSetWindowAttributes.Buffer, XVisualInfo.Buffer
public abstract class StructBuffer<T extends Struct,SELF extends StructBuffer<T,SELF>> extends CustomBuffer<SELF> implements java.lang.Iterable<T>
Base class of struct custom buffers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer
Pointer.Default
-
-
Field Summary
-
Fields inherited from interface org.lwjgl.system.Pointer
POINTER_SHIFT, POINTER_SIZE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
forEach(java.util.function.Consumer<? super T> action)
T
get()
Relative get method.T
get(int index)
Absolute get method.SELF
get(int index, T value)
Absolute get method.SELF
get(T value)
Relative get method.java.util.Iterator<T>
iterator()
java.util.stream.Stream<T>
parallelStream()
Returns a parallelStream
with this struct buffer as its source.SELF
put(int index, T value)
Absolute put method (optional operation).SELF
put(T value)
Relative put method (optional operation).java.util.Spliterator<T>
spliterator()
java.util.stream.Stream<T>
stream()
Returns a sequentialStream
with this struct buffer as its source.
-
-
-
Method Detail
-
get
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:
- the struct at the buffer's current position
- Throws:
java.nio.BufferUnderflowException
- If the buffer's current position is not smaller than its limit
-
get
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:
- the struct at the buffer's current position
- Throws:
java.nio.BufferUnderflowException
- If the buffer's current position is not smaller than its limit
-
put
public SELF put(T value)
Relative put method (optional operation).Writes the specified struct into this buffer at the current position, and then increments the position.
- Parameters:
value
- the struct to be written- Returns:
- This buffer
- Throws:
java.nio.BufferOverflowException
- If this buffer's current position is not smaller than its limitjava.nio.ReadOnlyBufferException
- If this buffer is read-only
-
get
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
- the index from which the struct will be read- Returns:
- the struct at the specified index
- Throws:
java.lang.IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit
-
get
public SELF get(int index, T value)
Absolute get method. Reads the struct data at the specified index into the specified struct.- Parameters:
index
- the index from which the struct will be read- Returns:
- the struct at the specified index
- Throws:
java.lang.IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limit
-
put
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
- the index at which the struct will be writtenvalue
- the struct value to be written- Returns:
- This buffer
- Throws:
java.lang.IndexOutOfBoundsException
- If index is negative or not smaller than the buffer's limitjava.nio.ReadOnlyBufferException
- If this buffer is read-only
-
iterator
public java.util.Iterator<T> iterator()
-
forEach
public void forEach(java.util.function.Consumer<? super T> action)
-
spliterator
public java.util.Spliterator<T> spliterator()
-
stream
public java.util.stream.Stream<T> stream()
Returns a sequentialStream
with this struct buffer as its source.
-
parallelStream
public java.util.stream.Stream<T> parallelStream()
Returns a parallelStream
with this struct buffer as its source.
-
-