java.lang.Object
org.yamcs.cfdp.CfdpUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byteboolToByte(boolean bool, int bitnr) if bool is true, write bit 1 on bitnr positionstatic intgetBitOfByte(Byte input, int bitnr) static shortgetUnsignedByte(ByteBuffer buffer) static longgetUnsignedInt(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 LonggetUnsignedLongFromBuffer(ByteBuffer buffer, int nrOfBytesToRead) static longgetUnsignedLongFromByteArray(byte[] input) static intgetUnsignedShort(ByteBuffer buffer) static booleanisBitOfByteSet(Byte input, int bitnr) static byte[]longToBytes(long input, int length) static voidwriteUnsignedByte(ByteBuffer buffer, int input) static voidwriteUnsignedInt(ByteBuffer buffer, long input) Write the given long as an unsigned int to the given buffer at its current position
-
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 -
writeUnsignedInt
Write the given long as an unsigned int to the given buffer at its current position -
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) -
longToBytes
public static byte[] longToBytes(long input, int length)
-