Package org.yamcs.cfdp
Class CfdpUtils
- java.lang.Object
-
- org.yamcs.cfdp.CfdpUtils
-
public class CfdpUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description CfdpUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byteboolToByte(boolean bool)static 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
-
-
-
Method Detail
-
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
-
writeUnsignedInt
public static void writeUnsignedInt(ByteBuffer buffer, long input)
Write the given long as an unsigned int to the given buffer at its current position
-
getUnsignedLongFromBuffer
public static Long getUnsignedLongFromBuffer(ByteBuffer buffer, int nrOfBytesToRead)
-
boolToByte
public static byte boolToByte(boolean bool)
-
getUnsignedLongFromByteArray
public static long getUnsignedLongFromByteArray(byte[] input)
-
longToBytes
public static byte[] longToBytes(long input, int length)
-
-