public class ByteUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
NON_ASCII_STRING |
Constructor and Description |
---|
ByteUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
bytesToHex(byte[] bytes) |
static String |
bytesToHex(byte[] bytes,
int groupSize) |
static int |
bytesToInt(byte[] b) |
static String |
byteToChar(byte value) |
static long |
convertTextBytes(String text) |
static String |
debugByteArray(byte[] byteArray)
Simplify reading of a byte array in a programmers understable way
|
static void |
debugFrame(Logger logger,
String message,
io.netty.buffer.ByteBuf byteIn) |
static byte[] |
doubleLongToBytes(long value1,
long value2) |
static boolean |
equals(byte[] left,
byte[] right) |
static boolean |
equals(byte[] left,
byte[] right,
int rightOffset,
int rightLength) |
static boolean |
equals(byte[] bytes,
io.netty.buffer.ByteBuf byteBuf,
int offset,
int length)
|
static String |
formatGroup(String str,
int groupSize,
int lineBreak) |
static byte[] |
getActiveArray(ByteBuffer buffer) |
static byte[] |
hexToBytes(String hexStr) |
static int |
intFromBytes(byte b1,
byte b2,
byte b3,
byte b4) |
static byte[] |
intToBytes(int value) |
static byte[] |
longToBytes(long value) |
static void |
longToBytes(long x,
byte[] output,
int offset) |
static String |
maxString(String value,
int size) |
static String |
readLine(ActiveMQBuffer buffer) |
static String |
toSimpleString(byte[] bytes) |
static void |
zeros(ByteBuffer buffer)
It zeroes the whole
Buffer.capacity() of the given buffer . |
static void |
zeros(ByteBuffer buffer,
int offset,
int bytes)
It zeroes
bytes of the given buffer , starting (inclusive) from offset . |
public static final String NON_ASCII_STRING
public static void debugFrame(Logger logger, String message, io.netty.buffer.ByteBuf byteIn)
public static String bytesToHex(byte[] bytes)
public static String debugByteArray(byte[] byteArray)
public static String byteToChar(byte value)
public static String bytesToHex(byte[] bytes, int groupSize)
public static String toSimpleString(byte[] bytes)
public static final byte[] intToBytes(int value)
public static int bytesToInt(byte[] b)
public static byte[] longToBytes(long value)
public static void longToBytes(long x, byte[] output, int offset)
public static byte[] doubleLongToBytes(long value1, long value2)
public static byte[] hexToBytes(String hexStr)
public static String readLine(ActiveMQBuffer buffer)
public static byte[] getActiveArray(ByteBuffer buffer)
public static long convertTextBytes(String text)
public static boolean equals(byte[] left, byte[] right)
public static boolean equals(byte[] left, byte[] right, int rightOffset, int rightLength)
public static boolean equals(byte[] bytes, io.netty.buffer.ByteBuf byteBuf, int offset, int length)
true
if the SimpleString
encoded content into bytes
is equals to s
,
false
otherwise.
It assumes that the bytes
content is read using SimpleString.readSimpleString(ByteBuf, int)
ie starting right after the
length field.
public static int intFromBytes(byte b1, byte b2, byte b3, byte b4)
public static void zeros(ByteBuffer buffer)
Buffer.capacity()
of the given buffer
.ReadOnlyBufferException
- if buffer
is read-onlypublic static void zeros(ByteBuffer buffer, int offset, int bytes)
bytes
of the given buffer
, starting (inclusive) from offset
.IndexOutOfBoundsException
- if offset + bytes >
Buffer.capacity()
or offset >=
Buffer.capacity()
IllegalArgumentException
- if offset
or capacity
are less then 0ReadOnlyBufferException
- if buffer
is read-onlyCopyright © 2020 JBoss by Red Hat. All rights reserved.