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:
CGEventTapInformation.Buffer
,CGPoint.Buffer
,DEVMODE.Buffer
,DISPLAY_DEVICE.Buffer
,HARDWAREINPUT.Buffer
,INPUT.Buffer
,JNINativeMethod.Buffer
,KEYBDINPUT.Buffer
,MONITORINFOEX.Buffer
,MOUSEINPUT.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
,XAnyEvent.Buffer
,XButtonEvent.Buffer
,XCirculateEvent.Buffer
,XCirculateRequestEvent.Buffer
,XClientMessageEvent.Buffer
,XColormapEvent.Buffer
,XConfigureEvent.Buffer
,XConfigureRequestEvent.Buffer
,XCreateWindowEvent.Buffer
,XCrossingEvent.Buffer
,XDestroyWindowEvent.Buffer
,XErrorEvent.Buffer
,XEvent.Buffer
,XExposeEvent.Buffer
,XFocusChangeEvent.Buffer
,XGenericEvent.Buffer
,XGenericEventCookie.Buffer
,XGraphicsExposeEvent.Buffer
,XGravityEvent.Buffer
,XKeyEvent.Buffer
,XKeymapEvent.Buffer
,XMapEvent.Buffer
,XMappingEvent.Buffer
,XMapRequestEvent.Buffer
,XMotionEvent.Buffer
,XNoExposeEvent.Buffer
,XPropertyEvent.Buffer
,XReparentEvent.Buffer
,XResizeRequestEvent.Buffer
,XSelectionClearEvent.Buffer
,XSelectionEvent.Buffer
,XSelectionRequestEvent.Buffer
,XSetWindowAttributes.Buffer
,XTimeCoord.Buffer
,XUnmapEvent.Buffer
,XVisibilityEvent.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, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELF
apply(int index, java.util.function.Consumer<T> consumer)
Absolute apply method.SELF
apply(java.util.function.Consumer<T> consumer)
Relative apply method.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).int
sizeof()
Returns thesizeof
a single element in the buffer.java.util.Spliterator<T>
spliterator()
java.util.stream.Stream<T>
stream()
Returns a sequentialStream
with 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:CustomBuffer
Returns thesizeof
a single element in the buffer.- Specified by:
sizeof
in 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
- Ifindex
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
- Ifindex
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
- Ifindex
is negative or not smaller than the buffer's limitjava.nio.ReadOnlyBufferException
- If this buffer is read-only
-
apply
public SELF apply(java.util.function.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:
- This buffer
- Throws:
java.nio.BufferUnderflowException
- If the buffer's current position is not smaller than its limit
-
apply
public SELF apply(int index, java.util.function.Consumer<T> consumer)
Absolute apply method.Passes the struct at the specified position to the specified
Consumer
.- Parameters:
index
- the index where theconsumer
will be applied.- Returns:
- This buffer
- Throws:
java.lang.IndexOutOfBoundsException
- Ifindex
is negative or not smaller than the buffer's limit
-
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.
-
-