public class BitConverter extends Object
| 构造器和说明 |
|---|
BitConverter() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
getBytes(boolean data)
Returns the specified Boolean value as a byte array.
|
static byte[] |
getBytes(char data)
Returns the specified Unicode character value as a byte array.
|
static byte[] |
getBytes(double data)
Returns the specified double - precision floating-point value as a byte array.
|
static byte[] |
getBytes(float data)
Returns the specified 64-bit signed integer value as a byte array.
|
static byte[] |
getBytes(int data)
Returns the specified 32-bit signed integer value as a byte array.
|
static byte[] |
getBytes(long data)
Returns the specified 64-bit signed integer value as a byte array.
|
static byte[] |
getBytes(short data)
Returns the specified 16-bit signed integer value as a byte array.
|
static byte[] |
getBytes(String data)
Encodes all characters in the specified string as a sequence of bytes.
|
static byte[] |
getBytes(String data,
String charsetName)
Encodes all characters in the specified string as a sequence of bytes.
|
static boolean |
toBoolean(byte[] bytes)
Returns a Boolean value converted from an array of bytes.
|
static boolean |
toBoolean(byte[] bytes,
int startIndex)
Returns a Boolean value converted from a specified byte in the byte array.
|
static char |
toChar(byte[] bytes)
Returns a Unicode character converted from a byte array.
|
static char |
toChar(byte[] bytes,
int startIndex)
Returns the Unicode character converted from the specified two bytes in the byte array.
|
static double |
toDouble(byte[] bytes)
Returns a double - precision floating-point number converted from a byte array.
|
static double |
toDouble(byte[] bytes,
int startIndex)
Returns a double - precision floating-point number converted from the specified eight bytes in
the byte array.
|
static float |
toFloat(byte[] bytes)
Returns a single-precision floating-point number converted from a byte array.
|
static float |
toFloat(byte[] bytes,
int startIndex)
Returns a single-precision floating-point number converted from the specified four bytes in the
byte array.
|
static String |
toHexString(byte[] bytes)
Returns the contents of the byte array as a string representation.
|
static int |
toInt(byte[] bytes)
Returns a 32-bit signed integer converted from a byte array.
|
static int |
toInt(byte[] bytes,
int startIndex)
Returns a 32-bit signed integer converted from the specified four bytes in the byte array.
|
static long |
toLong(byte[] bytes)
Returns a 64-bit signed integer converted from a byte array.
|
static long |
toLong(byte[] bytes,
int startIndex)
Returns a 64-bit signed integer converted from the specified eight bytes in the byte array.
|
static short |
toShort(byte[] bytes)
Returns a 16-bit signed integer converted from a byte array.
|
static short |
toShort(byte[] bytes,
int startIndex)
Returns a 16-bit signed integer converted from the specified two bytes in the byte array.
|
static String |
toString(byte[] bytes)
Returns a string converted from an array of bytes.
|
static String |
toString(byte[] bytes,
String charsetName)
Returns a string converted from an array of bytes.
|
public static byte[] getBytes(boolean data)
data - A Boolean valuepublic static byte[] getBytes(short data)
data - The number to convertpublic static byte[] getBytes(char data)
data - The character to convertpublic static byte[] getBytes(int data)
data - The number to convertpublic static byte[] getBytes(long data)
data - The number to convertpublic static byte[] getBytes(float data)
data - The number to convertpublic static byte[] getBytes(double data)
data - The number to convertpublic static byte[] getBytes(String data)
data - A string containing the characters to be encodedpublic static byte[] getBytes(String data, String charsetName)
data - A string containing the characters to be encodedcharsetName - Character set codingpublic static boolean toBoolean(byte[] bytes)
bytes - byte arraypublic static boolean toBoolean(byte[] bytes,
int startIndex)
bytes - byte arraystartIndex - Starting the subscriptpublic static short toShort(byte[] bytes)
bytes - byte arraypublic static short toShort(byte[] bytes,
int startIndex)
bytes - byte arraystartIndex - Starting the subscriptpublic static char toChar(byte[] bytes)
bytes - byte arraypublic static char toChar(byte[] bytes,
int startIndex)
bytes - byte arraystartIndex - Starting the subscriptpublic static int toInt(byte[] bytes)
bytes - byte arraypublic static int toInt(byte[] bytes,
int startIndex)
bytes - byte arraystartIndex - Starting the subscriptpublic static long toLong(byte[] bytes)
bytes - byte arraypublic static long toLong(byte[] bytes,
int startIndex)
bytes - byte arraystartIndex - Starting the subscriptpublic static float toFloat(byte[] bytes)
bytes - byte arraypublic static float toFloat(byte[] bytes,
int startIndex)
bytes - byte arraystartIndex - Starting the subscriptpublic static double toDouble(byte[] bytes)
bytes - byte arraypublic static double toDouble(byte[] bytes,
int startIndex)
bytes - byte arraystartIndex - Starting the subscriptpublic static String toString(byte[] bytes)
bytes - byte arraypublic static String toString(byte[] bytes, String charsetName)
bytes - byte arraycharsetName - Character set codingpublic static String toHexString(byte[] bytes)
bytes - byte arrayCopyright © 2020. All rights reserved.