Class TermScanner

java.lang.Object
io.aeron.logbuffer.TermScanner

public final class TermScanner extends Object
Scans a term buffer for an availability range of message fragments.

This can be used to concurrently read a term buffer which is being appended to.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    available(long result)
    The number of bytes that are available to be read after a scan.
    static long
    pack(int padding, int available)
    Pack the values for available and padding into a long for returning on the stack.
    static int
    padding(long result)
    The count of bytes that should be added for padding to the position on top of what is available.
    static long
    scanForAvailability(UnsafeBuffer termBuffer, int offset, int maxLength)
    Scan the term buffer for availability of new message fragments from a given offset up to a maxLength of bytes.

    Methods inherited from class java.lang.Object

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

    • TermScanner

      public TermScanner()
  • Method Details

    • scanForAvailability

      public static long scanForAvailability(UnsafeBuffer termBuffer, int offset, int maxLength)
      Scan the term buffer for availability of new message fragments from a given offset up to a maxLength of bytes.
      Parameters:
      termBuffer - to be scanned for new message fragments.
      offset - at which the scan should begin.
      maxLength - in bytes of how much should be scanned.
      Returns:
      resulting status of the scan which packs the available bytes and padding into a long. The available bytes can be negative which indicates that there was data to send.
    • pack

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

      public static int available(long result)
      The number of bytes that are available to be read after a scan.
      Parameters:
      result - into which the padding value has been packed.
      Returns:
      the count of bytes that are available to be read.
    • padding

      public static int padding(long result)
      The count of bytes that should be added for padding to the position on top of what is available.
      Parameters:
      result - into which the padding value has been packed.
      Returns:
      the count of bytes that should be added for padding to the position on top of what is available.