Package io.aeron.logbuffer
Class TermReader
java.lang.Object
io.aeron.logbuffer.TermReader
Utility functions for reading a term within a log buffer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intfragmentsRead(long readOutcome) The number of fragments that have been read.static intoffset(long readOutcome) The offset up to which the term has progressed.static longpack(int offset, int fragmentsRead) Pack the values for fragmentsRead and offset into a long for returning on the stack.static longread(UnsafeBuffer termBuffer, int termOffset, FragmentHandler handler, int fragmentsLimit, Header header, ErrorHandler errorHandler) Reads data from a term in a log buffer.static intread(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 passedPositionso progress is not lost in the event of an exception.
-
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 passedPositionso 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 readfragmentsLimit- 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 fragmentssubscriberPosition- 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 readfragmentsLimit- 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.
-