Package io.aeron

Class DirectBufferVector

java.lang.Object
io.aeron.DirectBufferVector

public final class DirectBufferVector extends Object
Vector into a DirectBuffer to be used for gathering IO as and offset and length.
  • Constructor Details

    • DirectBufferVector

      public DirectBufferVector()
      Default constructor so the fluent API can be used.
    • DirectBufferVector

      public DirectBufferVector(DirectBuffer buffer, int offset, int length)
      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

      public DirectBufferVector reset(DirectBuffer buffer, int offset, int length)
      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

      public DirectBuffer buffer()
      The buffer which the vector applies to.
      Returns:
      buffer which the vector applies to.
    • buffer

      public DirectBufferVector buffer(DirectBuffer 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

      public DirectBufferVector offset(int 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

      public DirectBufferVector length(int 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

      public DirectBufferVector 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

      public String toString()
      Overrides:
      toString in class Object
    • validateAndComputeLength

      public static int validateAndComputeLength(DirectBufferVector[] vectors)
      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.