Package org.yamcs.cfdp
Class CfdpUtils
java.lang.Object
org.yamcs.cfdp.CfdpUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte
boolToByte
(boolean bool, int bitnr) if bool is true, write bit 1 on bitnr positionstatic int
getBitOfByte
(Byte input, int bitnr) static short
getUnsignedByte
(ByteBuffer buffer) 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 thisstatic Long
getUnsignedLongFromBuffer
(ByteBuffer buffer, int nrOfBytesToRead) static long
getUnsignedLongFromByteArray
(byte[] input) 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.static int
getUnsignedShort
(ByteBuffer buffer) static boolean
isBitOfByteSet
(Byte input, int bitnr) static byte[]
longToBytesFixed
(long input, int length) static byte[]
longToTrimmedBytes
(long input) static void
writeUnsignedByte
(ByteBuffer buffer, int input) static void
writeUnsignedInt
(ByteBuffer buffer, long input) Write the given long as an unsigned int (32bits) to the given buffer at its current positionstatic void
writeUnsignedLong
(ByteBuffer buffer, long input) Write the given long as an unsigned long (64bits) to the given buffer at its current positionstatic 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.
-
Constructor Details
-
CfdpUtils
public CfdpUtils()
-
-
Method Details
-
isBitOfByteSet
-
getBitOfByte
-
getUnsignedByte
-
writeUnsignedByte
-
getUnsignedShort
-
getUnsignedInt
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
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
Write the given long as an unsigned int (32bits) to the given buffer at its current position -
writeUnsignedLong
Write the given long as an unsigned long (64bits) to the given buffer at its current position -
writeUnsignedNumber
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
-
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)
-