Package org.lwjgl.system
Class StructBuffer<T extends Struct,SELF extends StructBuffer<T,SELF>>
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- 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
BITS32, BITS64, POINTER_SHIFT, POINTER_SIZE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforEach(java.util.function.Consumer<? super T> action)Tget()Relative get method.Tget(int index)Absolute get method.SELFget(int index, T value)Absolute get method.SELFget(T value)Relative get method.java.util.Iterator<T>iterator()java.util.stream.Stream<T>parallelStream()Returns a parallelStreamwith this struct buffer as its source.SELFput(int index, T value)Absolute put method (optional operation).SELFput(T value)Relative put method (optional operation).intsizeof()Returns thesizeofa single element in the buffer.java.util.Spliterator<T>spliterator()java.util.stream.Stream<T>stream()Returns a sequentialStreamwith this struct buffer as its source.-
Methods inherited from class org.lwjgl.system.CustomBuffer
address, address, address0, capacity, clear, compact, duplicate, flip, free, hasRemaining, limit, limit, mark, position, position, put, remaining, reset, rewind, slice, slice, toString
-
Methods inherited from class org.lwjgl.system.Pointer.Default
equals, hashCode
-
-
-
-
Method Detail
-
sizeof
public int sizeof()
Description copied from class:CustomBufferReturns thesizeofa single element in the buffer.- Specified by:
sizeofin classCustomBuffer<SELF extends StructBuffer<T,SELF>>
-
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- Ifindexis 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- Ifindexis 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- Ifindexis 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 sequentialStreamwith this struct buffer as its source.
-
parallelStream
public java.util.stream.Stream<T> parallelStream()
Returns a parallelStreamwith this struct buffer as its source.
-
-