Class ByteUtil
- java.lang.Object
- 
- org.opendaylight.openflowplugin.openflow.md.util.ByteUtil
 
- 
 public final class ByteUtil extends Object 
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbytesToHexstring(byte[] bytes, String delimiter)Converts bytes to a hex string.static longbytesToUnsignedInt(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 @org.eclipse.jdt.annotation.Nullable byte[]convertBigIntegerToNBytes(@Nullable BigInteger bigInteger, int numBytes)Utility method to convert BigInteger to n element byte array.static @org.eclipse.jdt.annotation.Nullable byte[]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 Detail- 
bytesToHexstringpublic static String bytesToHexstring(byte[] bytes, String delimiter) Converts 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 @org.eclipse.jdt.annotation.Nullable byte[] 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 @org.eclipse.jdt.annotation.Nullable byte[] 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 long 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
 
 - 
unsignedIntToBytespublic static byte[] unsignedIntToBytes(Long 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
 
 - 
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
 
 - 
unsignedMediumToBytespublic static byte[] unsignedMediumToBytes(Long 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
 
 - 
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
 
 - 
unsignedShortToBytespublic static byte[] unsignedShortToBytes(Integer 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
 
 - 
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
 
 
- 
 
-