Class HeaderWriter

java.lang.Object
io.aeron.logbuffer.HeaderWriter

public class HeaderWriter extends Object
Utility for applying a header to a message in a term buffer.

This class is designed to be thread safe to be used across multiple producers and makes the header visible in the correct order for consumers.

  • Method Details

    • newInstance

      public static HeaderWriter newInstance(UnsafeBuffer defaultHeader)
      Create a new HeaderWriter that is ByteOrder specific to the platform.
      Parameters:
      defaultHeader - for the stream.
      Returns:
      a new HeaderWriter that is ByteOrder specific to the platform.
    • write

      public void write(UnsafeBuffer termBuffer, int offset, int length, int termId)
      Write a header to the term buffer in ByteOrder.LITTLE_ENDIAN format using the minimum instructions.
      Parameters:
      termBuffer - to be written to.
      offset - at which the header should be written.
      length - of the fragment including the header.
      termId - of the current term buffer.