public final class DirectBufferVector extends Object
DirectBuffer
to be used for gathering IO as and offset and length.Constructor and Description |
---|
DirectBufferVector()
Default 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.
|
Modifier and Type | Method and Description |
---|---|
DirectBuffer |
buffer()
The buffer which the vector applies to.
|
DirectBufferVector |
buffer(DirectBuffer buffer)
The buffer which the vector applies to.
|
int |
length()
Length of the vector in the buffer starting at the offset.
|
DirectBufferVector |
length(int length)
Length of the vector in the buffer starting at the offset.
|
int |
offset()
Offset in the buffer at which the vector starts.
|
DirectBufferVector |
offset(int offset)
Offset in the buffer at which the vector starts.
|
DirectBufferVector |
reset(DirectBuffer buffer,
int offset,
int length)
Reset the values.
|
String |
toString() |
DirectBufferVector |
validate()
Ensure the vector is valid for the buffer.
|
static int |
validateAndComputeLength(DirectBufferVector[] vectors)
Validate an array of vectors to make up a message and compute the total length.
|
public DirectBufferVector()
public DirectBufferVector(DirectBuffer buffer, int offset, int length)
buffer
- which is the super set.offset
- at which the vector begins.length
- of the vector.public DirectBufferVector reset(DirectBuffer buffer, int offset, int length)
buffer
- which is the super set.offset
- at which the vector begins.length
- of the vector.public DirectBuffer buffer()
public DirectBufferVector buffer(DirectBuffer buffer)
buffer
- which the vector applies to.public int offset()
public DirectBufferVector offset(int offset)
offset
- in the buffer at which the vector starts.public int length()
public DirectBufferVector length(int length)
length
- of the vector in the buffer starting at the offset.public DirectBufferVector validate()
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.public static int validateAndComputeLength(DirectBufferVector[] vectors)
vectors
- to be validated summed.Copyright © 2014-2022 Real Logic Limited. All Rights Reserved.