Class CfdpUtils

java.lang.Object
org.yamcs.cfdp.CfdpUtils

public class CfdpUtils extends Object
  • Constructor Details

    • CfdpUtils

      public CfdpUtils()
  • Method Details

    • isBitOfByteSet

      public static boolean isBitOfByteSet(Byte input, int bitnr)
    • getBitOfByte

      public static int getBitOfByte(Byte input, int bitnr)
    • getUnsignedByte

      public static short getUnsignedByte(ByteBuffer buffer)
    • writeUnsignedByte

      public static void writeUnsignedByte(ByteBuffer buffer, int input)
    • getUnsignedShort

      public static int getUnsignedShort(ByteBuffer buffer)
    • getUnsignedInt

      public static long getUnsignedInt(ByteBuffer buffer)
      get an unsigned int value from an input buffer, at its current position A short has range -2ˆ31+1 to 2ˆ31-1, while we want 0 to 2ˆ32-1, the mask and int cast takes care of this
    • getUnsignedNumber

      public static long getUnsignedNumber(ByteBuffer buffer, boolean is64bits)
      Gets an unsigned 32-bit integer or 64-bit long from the given buffer depending on the is64bits parameter. Useful for FSS (File-Size Sensitive) data type
    • writeUnsignedInt

      public static void writeUnsignedInt(ByteBuffer buffer, long input)
      Write the given long as an unsigned int (32bits) to the given buffer at its current position
    • writeUnsignedLong

      public static void writeUnsignedLong(ByteBuffer buffer, long input)
      Write the given long as an unsigned long (64bits) to the given buffer at its current position
    • writeUnsignedNumber

      public static void writeUnsignedNumber(ByteBuffer buffer, long input, boolean is64bits)
      Writes the given long as either unsigned 32-bit integer or unsigned 64-bit long depending on the is64bits parameter. Useful for FSS (File-Size Sensitive) data type
    • getUnsignedLongFromBuffer

      public static Long getUnsignedLongFromBuffer(ByteBuffer buffer, int nrOfBytesToRead)
    • boolToByte

      public static byte boolToByte(boolean bool, int bitnr)
      if bool is true, write bit 1 on bitnr position
    • getUnsignedLongFromByteArray

      public static long getUnsignedLongFromByteArray(byte[] input)
    • longToBytesFixed

      public static byte[] longToBytesFixed(long input, int length)
    • longToTrimmedBytes

      public static byte[] longToTrimmedBytes(long input)