public final class DirectBufferVector
extends java.lang.Object
DirectBuffer
to be used for gathering IO as and offset and length.Modifier and Type | Field and Description |
---|---|
org.agrona.DirectBuffer |
buffer |
int |
length |
int |
offset |
Constructor and Description |
---|
DirectBufferVector()
Default constructor so the fluent API can be used.
|
DirectBufferVector(org.agrona.DirectBuffer buffer,
int offset,
int length)
Construct a new vector as a subset of a buffer.
|
Modifier and Type | Method and Description |
---|---|
org.agrona.DirectBuffer |
buffer()
The buffer which the vector applies to.
|
DirectBufferVector |
buffer(org.agrona.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(org.agrona.DirectBuffer buffer,
int offset,
int length)
Reset the values.
|
java.lang.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 org.agrona.DirectBuffer buffer
public int offset
public int length
public DirectBufferVector()
public DirectBufferVector(org.agrona.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(org.agrona.DirectBuffer buffer, int offset, int length)
buffer
- which is the super set.offset
- at which the vector begins.length
- of the vector.public org.agrona.DirectBuffer buffer()
public DirectBufferVector buffer(org.agrona.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()
java.lang.NullPointerException
- if the buffer is null.java.lang.IllegalArgumentException
- if the offset is out of range for the buffer.java.lang.IllegalArgumentException
- if the length is out of range for the buffer.public java.lang.String toString()
toString
in class java.lang.Object
public static int validateAndComputeLength(DirectBufferVector[] vectors)
vectors
- to be validated summed.Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.