public class BytesUtils extends Object
| 构造器和说明 |
|---|
BytesUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static double |
beToDouble(byte[] src) |
static double |
beToDouble(byte[] src,
int offset,
int len) |
static float |
beToFloat(byte[] src) |
static float |
beToFloat(byte[] src,
int offset,
int len) |
static int |
beToInt(byte[] src)
低位字节数组转int,低字节在后
-------------------------------------
| 31-24位 | 23-17位 | 16-8位 | 7-0位 |
-------------------------------------
|
static int |
beToInt(byte[] src,
int offset,
int len)
大端模式,字节数组转int,高位字节在前,低字节在后.
------------------------------------
| 31-24位 | 23-16位 | 15-8位 | 7-0位 |
------------------------------------
|
static long |
beToLong(byte[] src) |
static long |
beToLong(byte[] src,
int offset,
int len)
低位字节数组转long,高位字节在前,低字节在后.
---------------------------------------------------------------------------
| 63-56位 | 55-48位 | 47-40位 | 39-32位 | 31-24位 | 23-16位 | 15-8位 | 7-0位 |
----------------------------------------------------------------------------
|
static byte[] |
doubleToBe(byte[] target,
double number,
int offset) |
static byte[] |
doubleToBe(double src) |
static byte[] |
doubleToLe(byte[] target,
double number,
int offset) |
static byte[] |
doubleToLe(double src) |
static byte[] |
floatToBe(byte[] target,
float number,
int offset) |
static byte[] |
floatToBe(float src) |
static byte[] |
floatToLe(byte[] target,
float number,
int offset) |
static byte[] |
floatToLe(float src) |
static double |
highBytesToDouble(byte[] src)
已过时。
|
static double |
highBytesToDouble(byte[] src,
int offset,
int len)
已过时。
|
static float |
highBytesToFloat(byte[] src)
已过时。
|
static float |
highBytesToFloat(byte[] src,
int offset,
int len)
已过时。
|
static int |
highBytesToInt(byte[] src)
已过时。
|
static int |
highBytesToInt(byte[] src,
int offset,
int len)
已过时。
|
static long |
highBytesToLong(byte[] src)
已过时。
|
static long |
highBytesToLong(byte[] src,
int offset,
int len)
已过时。
|
static byte[] |
intToBe(byte[] target,
int number,
int offset)
int转低位字节数组, 低字节在后
--------------------------------------------
| 31-24位 | 23-16位 | 15-8位 | 7-0位 |
--------------------------------------------
|
static byte[] |
intToBe(int src) |
static byte[] |
intToLe(byte[] target,
int number,
int offset)
int转小端模式字节数组,低字节在前
-------------------------------------------
| 0-7位 | 8-15位 | 16-23位 | 24-31位 |
-------------------------------------------
|
static byte[] |
intToLe(int src) |
static double |
leToDouble(byte[] src) |
static double |
leToDouble(byte[] src,
int offset,
int len)
小端模式,IEEE 754 字节数组转double,低位字节在前,高位字节在后.
|
static float |
leToFloat(byte[] src) |
static float |
leToFloat(byte[] src,
int offset,
int len)
小端模式,IEEE 754 字节数组转float,低位字节在前,高位字节在后.
|
static int |
leToInt(byte[] src) |
static int |
leToInt(byte[] src,
int offset,
int len)
小端模式转int,低字节在前.高在后.
-------------------------------------
| 0-7位 | 8-15位 | 16-23位 | 24-31位 |
-------------------------------------
|
static long |
leToLong(byte[] src) |
static long |
leToLong(byte[] src,
int offset,
int len)
小端模式转long,低字节在前.高在后.
---------------------------------------------------------------------------
| 0-7位 | 8-15位 | 16-23位 | 24-31位 | 32-39位 | 40-47位 | 48-55位 | 56-63位 |
---------------------------------------------------------------------------
|
static byte[] |
longToBe(byte[] target,
long number,
int offset) |
static byte[] |
longToBe(long src) |
static byte[] |
longToLe(byte[] target,
long number,
int offset) |
static byte[] |
longToLe(long src) |
static double |
lowBytesToDouble(byte[] src)
已过时。
|
static double |
lowBytesToDouble(byte[] src,
int offset,
int len)
已过时。
|
static float |
lowBytesToFloat(byte[] src)
已过时。
|
static float |
lowBytesToFloat(byte[] src,
int offset,
int len)
已过时。
|
static int |
lowBytesToInt(byte[] src)
已过时。
|
static int |
lowBytesToInt(byte[] src,
int offset,
int len)
已过时。
|
static long |
lowBytesToLong(byte[] src)
已过时。
|
static long |
lowBytesToLong(byte[] src,
int offset,
int len)
已过时。
|
static byte[] |
numberToBe(byte[] target,
Number number,
int offset,
int len)
数字大端模式转字节数组, 低字节在后
-------------------------------------
| 31-24位 | 23-16位 | 15-8位 | 7-0位 |
-------------------------------------
|
static byte[] |
numberToLe(byte[] target,
Number number,
int offset,
int len)
int转小端模式字节数组,低字节在前
---------------------------------------
| 0-7位 | 8-15位 | 16-23位 | 24-31位 |
---------------------------------------
|
static byte[] |
reverse(byte[] data) |
static byte[] |
reverse(byte[] data,
int offset,
int length)
反转数组. [4,3,2,1] => [1,2,3,4]
|
static byte[] |
shortToBe(byte[] target,
short number,
int offset) |
static byte[] |
shortToBe(short src) |
static byte[] |
shortToLe(byte[] target,
short number,
int offset) |
static byte[] |
shortToLe(short src) |
static byte[] |
toHighBytes(byte[] target,
long src,
int offset,
int len)
已过时。
|
static byte[] |
toHighBytes(double src)
已过时。
|
static byte[] |
toHighBytes(float src)
已过时。
|
static byte[] |
toHighBytes(int src)
已过时。
|
static byte[] |
toHighBytes(long src)
已过时。
|
static byte[] |
toLowBytes(byte[] target,
long src,
int offset,
int len)
已过时。
|
static byte[] |
toLowBytes(double src)
已过时。
|
static byte[] |
toLowBytes(float src)
已过时。
|
static byte[] |
toLowBytes(int src)
已过时。
|
static byte[] |
toLowBytes(long src)
已过时。
|
public static int leToInt(byte[] src,
int offset,
int len)
src - 数组offset - 偏移量len - 长度public static int leToInt(byte[] src)
public static long leToLong(byte[] src,
int offset,
int len)
src - 数组offset - 偏移量len - 长度public static long leToLong(byte[] src)
@Deprecated public static int highBytesToInt(byte[] src, int offset, int len)
@Deprecated public static long highBytesToLong(byte[] src, int offset, int len)
@Deprecated public static int highBytesToInt(byte[] src)
@Deprecated public static long highBytesToLong(byte[] src)
public static float leToFloat(byte[] src,
int offset,
int len)
src - 数组offset - 偏移量len - 长度highBytesToInt(byte[], int, int),
Float.intBitsToFloat(int)public static float leToFloat(byte[] src)
public static double leToDouble(byte[] src,
int offset,
int len)
src - 数组offset - 偏移量len - 长度highBytesToLong(byte[], int, int)public static double leToDouble(byte[] src)
@Deprecated public static float highBytesToFloat(byte[] src, int offset, int len)
@Deprecated public static double highBytesToDouble(byte[] src, int offset, int len)
@Deprecated public static float highBytesToFloat(byte[] src)
@Deprecated public static double highBytesToDouble(byte[] src)
public static int beToInt(byte[] src,
int offset,
int len)
src - 数组offset - 偏移量len - 长度@Deprecated public static int lowBytesToInt(byte[] src, int offset, int len)
public static long beToLong(byte[] src,
int offset,
int len)
src - 数组offset - 偏移量len - 长度public static float beToFloat(byte[] src,
int offset,
int len)
public static double beToDouble(byte[] src,
int offset,
int len)
@Deprecated public static long lowBytesToLong(byte[] src, int offset, int len)
@Deprecated public static float lowBytesToFloat(byte[] src, int offset, int len)
@Deprecated public static double lowBytesToDouble(byte[] src, int offset, int len)
public static int beToInt(byte[] src)
src - 字节数组@Deprecated public static int lowBytesToInt(byte[] src)
public static long beToLong(byte[] src)
@Deprecated public static long lowBytesToLong(byte[] src)
public static float beToFloat(byte[] src)
@Deprecated public static float lowBytesToFloat(byte[] src)
public static double beToDouble(byte[] src)
@Deprecated public static double lowBytesToDouble(byte[] src)
public static byte[] numberToLe(byte[] target,
Number number,
int offset,
int len)
number - 数字值target - 目标数组offset - 偏移量len - 总长度@Deprecated public static byte[] toHighBytes(byte[] target, long src, int offset, int len)
public static byte[] intToLe(byte[] target,
int number,
int offset)
number - 数字值target - 目标数组offset - 填充偏移量public static byte[] intToLe(int src)
public static byte[] shortToLe(byte[] target,
short number,
int offset)
public static byte[] shortToLe(short src)
public static byte[] longToLe(byte[] target,
long number,
int offset)
public static byte[] longToLe(long src)
public static byte[] floatToLe(byte[] target,
float number,
int offset)
public static byte[] floatToLe(float src)
public static byte[] doubleToLe(byte[] target,
double number,
int offset)
public static byte[] doubleToLe(double src)
@Deprecated public static byte[] toHighBytes(int src)
@Deprecated public static byte[] toHighBytes(long src)
@Deprecated public static byte[] toHighBytes(double src)
@Deprecated public static byte[] toHighBytes(float src)
public static byte[] numberToBe(byte[] target,
Number number,
int offset,
int len)
number - 数字值target - 目标数组offset - 偏移量len - 总长度@Deprecated public static byte[] toLowBytes(byte[] target, long src, int offset, int len)
public static byte[] intToBe(byte[] target,
int number,
int offset)
number - 数字值target - 目标数组offset - 偏移量public static byte[] intToBe(int src)
public static byte[] shortToBe(byte[] target,
short number,
int offset)
public static byte[] shortToBe(short src)
public static byte[] longToBe(byte[] target,
long number,
int offset)
public static byte[] longToBe(long src)
public static byte[] floatToBe(byte[] target,
float number,
int offset)
public static byte[] floatToBe(float src)
public static byte[] doubleToBe(byte[] target,
double number,
int offset)
public static byte[] doubleToBe(double src)
public static byte[] reverse(byte[] data,
int offset,
int length)
data - 数据offset - 偏移量length - 长度public static byte[] reverse(byte[] data)
@Deprecated public static byte[] toLowBytes(int src)
@Deprecated public static byte[] toLowBytes(long src)
@Deprecated public static byte[] toLowBytes(double src)
@Deprecated public static byte[] toLowBytes(float src)
Copyright © 2019–2022. All rights reserved.