public abstract class ByteBufUtils extends Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Splitter |
COLON_SPLITTER |
static com.google.common.base.Splitter |
DOT_SPLITTER |
Modifier and Type | Method and Description |
---|---|
static String |
byteBufToHexString(io.netty.buffer.ByteBuf bb)
Converts ByteBuf into String.
|
static String |
bytesToHexString(byte[] array)
Converts byte array into String.
|
static String |
decodeNullTerminatedString(io.netty.buffer.ByteBuf rawMessage,
int length)
Reads and parses null-terminated string from ByteBuf.
|
static int |
fillBitMask(int offset,
boolean... values)
Fills the bitmask from a set of bit values, starting at specified offset.
|
static int[] |
fillBitMaskFromList(List<Boolean> booleanList)
Fills the bitmask from boolean list where key is bit position.
|
static int |
fillBitMaskFromMap(Map<Integer,Boolean> booleanMap)
Fills the bitmask from boolean map where key is bit position.
|
static io.netty.buffer.ByteBuf |
hexStringToByteBuf(String hexSrc)
Creates ByteBuf filled with specified data.
|
static void |
hexStringToByteBuf(String hexSrc,
io.netty.buffer.ByteBuf out)
Creates ByteBuf filled with specified data.
|
static byte[] |
hexStringToBytes(String hexSrc)
Converts String into byte[].
|
static byte[] |
hexStringToBytes(String hexSrc,
boolean withSpaces)
Converts String into byte[].
|
static byte[] |
macAddressToBytes(String macAddress)
Converts macAddress to byte array.
|
static String |
macAddressToString(byte[] address)
Converts a MAC address represented in bytes to String.
|
static void |
padBuffer(int length,
io.netty.buffer.ByteBuf out)
Deprecated.
Use
ByteBuf.writeZero(int) directly. |
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address |
readIetfIpv4Address(io.netty.buffer.ByteBuf buf) |
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address |
readIetfIpv6Address(io.netty.buffer.ByteBuf buf) |
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress |
readIetfMacAddress(io.netty.buffer.ByteBuf buf) |
static String |
readIpv4Address(io.netty.buffer.ByteBuf buf)
Read an IPv4 address from a buffer and format it into dotted-quad string.
|
static String |
readIpv6Address(io.netty.buffer.ByteBuf buf)
Read an IPv6 address from a buffer and format it into a string of eight groups of four
hexadecimal digits separated by colons.
|
static byte[] |
serializeList(List<Short> list) |
static void |
updateOFHeaderLength(io.netty.buffer.ByteBuf out)
Write length standard OF header.
|
static void |
updateOFHeaderLength(io.netty.buffer.ByteBuf out,
int index)
Write length OF header.
|
static <E extends OfHeader> |
writeOFHeader(byte msgType,
E message,
io.netty.buffer.ByteBuf out,
int length)
Create standard OF header.
|
public static final com.google.common.base.Splitter DOT_SPLITTER
public static final com.google.common.base.Splitter COLON_SPLITTER
public static String byteBufToHexString(io.netty.buffer.ByteBuf bb)
bb
- input ByteBufpublic static byte[] hexStringToBytes(String hexSrc)
hexSrc
- input Stringpublic static byte[] hexStringToBytes(String hexSrc, boolean withSpaces)
hexSrc
- input StringwithSpaces
- if there are spaces in stringpublic static io.netty.buffer.ByteBuf hexStringToByteBuf(String hexSrc)
hexSrc
- input String of bytes in hex formatpublic static void hexStringToByteBuf(String hexSrc, io.netty.buffer.ByteBuf out)
hexSrc
- input String of bytes in hex formatout
- ByteBuf with specified hexString converted@Deprecated public static void padBuffer(int length, io.netty.buffer.ByteBuf out)
ByteBuf.writeZero(int)
directly.length
- the desired lengthout
- ByteBuf to be paddedpublic static <E extends OfHeader> void writeOFHeader(byte msgType, E message, io.netty.buffer.ByteBuf out, int length)
msgType
- message codemessage
- POJOout
- writing bufferlength
- ofheader lengthpublic static void updateOFHeaderLength(io.netty.buffer.ByteBuf out)
out
- writing bufferpublic static void updateOFHeaderLength(io.netty.buffer.ByteBuf out, int index)
out
- writing bufferindex
- writing indexpublic static int fillBitMaskFromMap(Map<Integer,Boolean> booleanMap)
booleanMap
- bit to boolean mappingpublic static int fillBitMask(int offset, boolean... values)
offset
- Bit offset to start atvalues
- boolean bit values to fillpublic static int[] fillBitMaskFromList(List<Boolean> booleanList)
booleanList
- bit to boolean mappingpublic static String bytesToHexString(byte[] array)
array
- input byte arraypublic static byte[] macAddressToBytes(String macAddress)
MacAddress
.macAddress
- the mac address to convertpublic static String macAddressToString(byte[] address)
MacAddress
.address
- the MAC address to convertpublic static String decodeNullTerminatedString(io.netty.buffer.ByteBuf rawMessage, int length)
rawMessage
- the message to parselength
- maximal length of Stringpublic static String readIpv4Address(io.netty.buffer.ByteBuf buf)
buf
- Input bufferpublic static String readIpv6Address(io.netty.buffer.ByteBuf buf)
buf
- Input bufferpublic static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address readIetfIpv4Address(io.netty.buffer.ByteBuf buf)
public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address readIetfIpv6Address(io.netty.buffer.ByteBuf buf)
public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress readIetfMacAddress(io.netty.buffer.ByteBuf buf)
Copyright © 2020 OpenDaylight. All rights reserved.