@ParametersAreNonnullByDefault public final class Bytes extends Object
byte arrays.| Modifier and Type | Method and Description |
|---|---|
static List<Byte> |
asList(byte... primitiveArray)
|
static byte[] |
toArray(List<Byte> boxedList)
|
static boolean |
toBoolean(byte[] bytes)
Decodes a
byte array to a boolean. |
static char |
toChar(byte[] bytes)
Decodes a
byte array to a char. |
static double |
toDouble(byte[] bytes)
Decodes a
byte array to a double. |
static float |
toFloat(byte[] bytes)
Decodes a
byte array to a float. |
static int |
toInt(byte[] bytes)
Decodes a
byte array to an int. |
static long |
toLong(byte[] bytes)
Decodes a
byte array to a long. |
static short |
toShort(byte[] bytes)
Decodes a
byte array to a short. |
static String |
toString(byte[] bytes)
Decodes a
byte array to a String. |
static String |
toStringBinary(byte[] bytes)
Decodes a
byte array to a String that contains each byte, in order, as a two-digit unsigned
hexadecimal number in lower case. |
public static boolean toBoolean(byte[] bytes)
byte array to a boolean.bytes - the byte array to decodebooleanNullPointerException - if the bytes is nullIllegalArgumentException - if the bytes.length is different from 1public static short toShort(byte[] bytes)
byte array to a short.bytes - the byte array to decodeshortNullPointerException - if the bytes is nullIllegalArgumentException - if the bytes.length is different from Short.BYTESpublic static char toChar(byte[] bytes)
byte array to a char.bytes - the byte array to decodecharNullPointerException - if the bytes is nullIllegalArgumentException - if the bytes.length is different from Character.BYTEStoShort(byte[])public static int toInt(byte[] bytes)
byte array to an int.bytes - the byte array to decodeintNullPointerException - if the bytes is nullIllegalArgumentException - if the bytes.length is different from Integer.BYTESpublic static long toLong(byte[] bytes)
byte array to a long.bytes - the byte array to decodelongNullPointerException - if the bytes is nullIllegalArgumentException - if the bytes.length is different from Long.BYTESpublic static float toFloat(byte[] bytes)
byte array to a float.bytes - the byte array to decodefloatNullPointerException - if the bytes is nullIllegalArgumentException - if the bytes.length is different from Float.BYTEStoInt(byte[]),
Float.intBitsToFloat(int)public static double toDouble(byte[] bytes)
byte array to a double.bytes - the byte array to decodedoubleNullPointerException - if the bytes is nullIllegalArgumentException - if the bytes.length is different from Double.BYTEStoLong(byte[]),
Double.longBitsToDouble(long)@Nonnull public static String toString(byte[] bytes)
byte array to a String.bytes - the byte array to decodeStringNullPointerException - if the bytes is nullIllegalArgumentException - if StandardCharsets.UTF_8 is not a supported encoding@Nonnull public static String toStringBinary(byte[] bytes)
byte array to a String that contains each byte, in order, as a two-digit unsigned
hexadecimal number in lower case.bytes - the byte array to decodeStringNullPointerException - if the bytes is nullStrings.toBytesBinary(String)@Nonnull public static List<Byte> asList(byte... primitiveArray)
primitiveArray - the byte array to convertList containing the same elements as primitiveArray, in the same order,
coverted to wrapper objects.Copyright © 2017–2019 Atlanmod. All rights reserved.