Class ByteUtil
java.lang.Object
org.opendaylight.openflowplugin.openflow.md.util.ByteUtil
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringbytesToHexstring(byte[] bytes, String delimiter) Converts bytes to a hex string.static org.opendaylight.yangtools.yang.common.Uint32bytesToUnsignedInt(byte[] bytes) Converts a 4 byte array of unsigned bytes to unsigned int.static longbytesToUnsignedMedium(byte[] bytes) Converts a 3 byte array of unsigned bytes to unsigned int.static intbytesToUnsignedShort(byte[] bytes) Converts a 2 byte array of unsigned bytes to unsigned short.static byte @Nullable []convertBigIntegerToNBytes(@Nullable BigInteger bigInteger, int numBytes) Utility method to convert BigInteger to n element byte array.static byte @Nullable []uint64toBytes(@Nullable org.opendaylight.yangtools.yang.common.Uint64 uint) Utility method to convert an Uint64 to an 8-byte array.static byte[]unsignedIntToBytes(Long unsignedInt) Converts unsigned integer to a 4 byte array of unsigned bytes.static byte[]unsignedIntToBytes(org.opendaylight.yangtools.yang.common.Uint32 unsignedInt) Converts unsigned integer to a 4 byte array of unsigned bytes.static byte[]unsignedMediumToBytes(Long unsignedInt) Converts unsigned integer to a 3 byte array of unsigned bytes.static byte[]unsignedMediumToBytes(org.opendaylight.yangtools.yang.common.Uint32 unsignedInt) Converts unsigned integer to a 3 byte array of unsigned bytes.static byte[]unsignedShortToBytes(Integer unsignedShort) Converts unsigned short to a 2 byte array of unsigned bytes.static byte[]unsignedShortToBytes(org.opendaylight.yangtools.yang.common.Uint16 unsignedShort) Converts unsigned short to a 2 byte array of unsigned bytes.
- 
Method Details- 
bytesToHexstringConverts bytes to a hex string.- Parameters:
- bytes- bytes that needs to be converted to hex
- delimiter- string delimiter
- Returns:
- hexString containing bytes, separated with delimiter
 
- 
convertBigIntegerToNBytespublic static byte @Nullable [] convertBigIntegerToNBytes(@Nullable BigInteger bigInteger, int numBytes) Utility method to convert BigInteger to n element byte array.- Parameters:
- bigInteger- big integer value that needs to be converted to byte
- numBytes- convert to number of bytes
- Returns:
- byte array containing n * 8 bits.
 
- 
uint64toBytespublic static byte @Nullable [] uint64toBytes(@Nullable org.opendaylight.yangtools.yang.common.Uint64 uint) Utility method to convert an Uint64 to an 8-byte array.- Parameters:
- uint- Unsigned long, potentially null.
- Returns:
- byte array, or null if input was null.
 
- 
bytesToUnsignedIntpublic static org.opendaylight.yangtools.yang.common.Uint32 bytesToUnsignedInt(byte[] bytes) Converts a 4 byte array of unsigned bytes to unsigned int.- Parameters:
- bytes- an array of 4 unsigned bytes
- Returns:
- a long representing the unsigned int
 
- 
bytesToUnsignedMediumpublic static long bytesToUnsignedMedium(byte[] bytes) Converts a 3 byte array of unsigned bytes to unsigned int.- Parameters:
- bytes- an array of 4 unsigned bytes
- Returns:
- a long representing the unsigned int
 
- 
bytesToUnsignedShortpublic static int bytesToUnsignedShort(byte[] bytes) Converts a 2 byte array of unsigned bytes to unsigned short.- Parameters:
- bytes- an array of 2 unsigned bytes
- Returns:
- an int representing the unsigned short
 
- 
unsignedIntToBytesConverts unsigned integer to a 4 byte array of unsigned bytes.- Parameters:
- unsignedInt- representing the unsigned integer
- Returns:
- bytes an array of 4 unsigned bytes
 
- 
unsignedIntToBytespublic static byte[] unsignedIntToBytes(org.opendaylight.yangtools.yang.common.Uint32 unsignedInt) Converts unsigned integer to a 4 byte array of unsigned bytes.- Parameters:
- unsignedInt- representing the unsigned integer
- Returns:
- bytes an array of 4 unsigned bytes
 
- 
unsignedMediumToBytesConverts unsigned integer to a 3 byte array of unsigned bytes.- Parameters:
- unsignedInt- representing the unsigned integer
- Returns:
- bytes an array of 3 unsigned bytes
 
- 
unsignedMediumToBytespublic static byte[] unsignedMediumToBytes(org.opendaylight.yangtools.yang.common.Uint32 unsignedInt) Converts unsigned integer to a 3 byte array of unsigned bytes.- Parameters:
- unsignedInt- representing the unsigned integer
- Returns:
- bytes an array of 3 unsigned bytes
 
- 
unsignedShortToBytesConverts unsigned short to a 2 byte array of unsigned bytes.- Parameters:
- unsignedShort- representing the unsigned short
- Returns:
- bytes an array of 2 unsigned bytes
 
- 
unsignedShortToBytespublic static byte[] unsignedShortToBytes(org.opendaylight.yangtools.yang.common.Uint16 unsignedShort) Converts unsigned short to a 2 byte array of unsigned bytes.- Parameters:
- unsignedShort- representing the unsigned short
- Returns:
- bytes an array of 2 unsigned bytes
 
 
-