Interface TimeEncoder

All Known Implementing Classes:
CucTimeEncoder

public interface TimeEncoder
Interface for time encoders used in the PacketPreprocessor
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    encode(long instant, byte[] buf, int offset)
    Encodes the Yamcs instant into the binary buffer.
    int
    encodeRaw(long time, byte[] buf, int offset)
    Encodes the time in an unspecified unit.
    int
    Returns the size in bytes of the encoded time.
  • Method Details

    • encode

      int encode(long instant, byte[] buf, int offset)
      Encodes the Yamcs instant into the binary buffer.

      It is assumed that the buffer will have enough space; if not, an ArrayIndexOutOfBoundsException will be thrown.

      Parameters:
      instant - - time in milliseconds to be encoded
      buf - - where to write the encoded time
      offset - - offset in the buffer where the encoding will begin
      Returns:
      the number of bytes encoded
    • encodeRaw

      int encodeRaw(long time, byte[] buf, int offset)
      Encodes the time in an unspecified unit.

      This can be used when the on-board time is free running.

      It is assumed that the buffer will have enough space; if not, an ArrayIndexOutOfBoundsException will be thrown.

      Parameters:
      time - - time in unspecified units to be encoded
      buf - - where to write the encoded time
      offset - - offset in the buffer where the encoding will begin
      Returns:
      the number of bytes encoded
    • getEncodedLength

      int getEncodedLength()
      Returns the size in bytes of the encoded time.

      If the size is variable return -1