Package io.aeron
Class DirectBufferVector
java.lang.Object
io.aeron.DirectBufferVector
Vector into a
DirectBuffer to be used for gathering IO as and offset and length.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor so the fluent API can be used.DirectBufferVector(DirectBuffer buffer, int offset, int length) Construct a new vector as a subset of a buffer. -
Method Summary
Modifier and TypeMethodDescriptionbuffer()The buffer which the vector applies to.buffer(DirectBuffer buffer) The buffer which the vector applies to.intlength()Length of the vector in the buffer starting at the offset.length(int length) Length of the vector in the buffer starting at the offset.intoffset()Offset in the buffer at which the vector starts.offset(int offset) Offset in the buffer at which the vector starts.reset(DirectBuffer buffer, int offset, int length) Reset the values.toString()validate()Ensure the vector is valid for the buffer.static intvalidateAndComputeLength(DirectBufferVector[] vectors) Validate an array of vectors to make up a message and compute the total length.
-
Constructor Details
-
DirectBufferVector
public DirectBufferVector()Default constructor so the fluent API can be used. -
DirectBufferVector
Construct a new vector as a subset of a buffer.- Parameters:
buffer- which is the super set.offset- at which the vector begins.length- of the vector.
-
-
Method Details
-
reset
Reset the values.- Parameters:
buffer- which is the super set.offset- at which the vector begins.length- of the vector.- Returns:
- this for a fluent API.
-
buffer
The buffer which the vector applies to.- Returns:
- buffer which the vector applies to.
-
buffer
The buffer which the vector applies to.- Parameters:
buffer- which the vector applies to.- Returns:
- this for a fluent API.
-
offset
public int offset()Offset in the buffer at which the vector starts.- Returns:
- offset in the buffer at which the vector starts.
-
offset
Offset in the buffer at which the vector starts.- Parameters:
offset- in the buffer at which the vector starts.- Returns:
- this for a fluent API.
-
length
public int length()Length of the vector in the buffer starting at the offset.- Returns:
- length of the vector in the buffer starting at the offset.
-
length
Length of the vector in the buffer starting at the offset.- Parameters:
length- of the vector in the buffer starting at the offset.- Returns:
- this for a fluent API.
-
validate
Ensure the vector is valid for the buffer.- Returns:
- this for a fluent API.
- Throws:
NullPointerException- if the buffer is null.IllegalArgumentException- if the offset is out of range for the buffer.IllegalArgumentException- if the length is out of range for the buffer.
-
toString
-
validateAndComputeLength
Validate an array of vectors to make up a message and compute the total length.- Parameters:
vectors- to be validated summed.- Returns:
- the sum of the vector lengths.
-