Class TermReader

java.lang.Object
io.aeron.logbuffer.TermReader

public class TermReader extends Object
Utility functions for reading a term within a log buffer.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    fragmentsRead(long readOutcome)
    The number of fragments that have been read.
    static int
    offset(long readOutcome)
    The offset up to which the term has progressed.
    static long
    pack(int offset, int fragmentsRead)
    Pack the values for fragmentsRead and offset into a long for returning on the stack.
    static long
    read(UnsafeBuffer termBuffer, int termOffset, FragmentHandler handler, int fragmentsLimit, Header header, ErrorHandler errorHandler)
    Reads data from a term in a log buffer.
    static int
    read(UnsafeBuffer termBuffer, int termOffset, FragmentHandler handler, int fragmentsLimit, Header header, ErrorHandler errorHandler, long currentPosition, Position subscriberPosition)
    Reads data from a term in a log buffer and updates a passed Position so progress is not lost in the event of an exception.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TermReader

      public TermReader()
  • Method Details

    • read

      public static int read(UnsafeBuffer termBuffer, int termOffset, FragmentHandler handler, int fragmentsLimit, Header header, ErrorHandler errorHandler, long currentPosition, Position subscriberPosition)
      Reads data from a term in a log buffer and updates a passed Position so progress is not lost in the event of an exception.
      Parameters:
      termBuffer - to be read for fragments.
      termOffset - within the buffer that the read should begin.
      handler - the handler for data that has been read
      fragmentsLimit - limit the number of fragments read.
      header - to be used for mapping over the header for a given fragment.
      errorHandler - to be notified if an error occurs during the callback.
      currentPosition - prior to reading further fragments
      subscriberPosition - to be updated after reading with new position
      Returns:
      the number of fragments read
    • read

      public static long read(UnsafeBuffer termBuffer, int termOffset, FragmentHandler handler, int fragmentsLimit, Header header, ErrorHandler errorHandler)
      Reads data from a term in a log buffer.
      Parameters:
      termBuffer - to be read for fragments.
      termOffset - within the buffer that the read should begin.
      handler - the handler for data that has been read
      fragmentsLimit - limit the number of fragments read.
      header - to be used for mapping over the header for a given fragment.
      errorHandler - to be notified if an error occurs during the callback.
      Returns:
      the number of fragments read
    • pack

      public static long pack(int offset, int fragmentsRead)
      Pack the values for fragmentsRead and offset into a long for returning on the stack.
      Parameters:
      offset - value to be packed.
      fragmentsRead - value to be packed.
      Returns:
      a long with both ints packed into it.
    • fragmentsRead

      public static int fragmentsRead(long readOutcome)
      The number of fragments that have been read.
      Parameters:
      readOutcome - into which the fragments read value has been packed.
      Returns:
      the number of fragments that have been read.
    • offset

      public static int offset(long readOutcome)
      The offset up to which the term has progressed.
      Parameters:
      readOutcome - into which the offset value has been packed.
      Returns:
      the offset up to which the term has progressed.