ArrayHelper
public
final
class
ArrayHelper
extends Object
| java.lang.Object | |
| ↳ | com.android.ddmlib.utils.ArrayHelper |
实用程序类,用于将通过 adb 从设备接收的数据进行数组到 int/long 的转换。
摘要
公共构造函数 | |
|---|---|
ArrayHelper()
|
|
公共方法 | |
|---|---|
static
int
|
swap32bitFromArray(byte[] value, int offset)
从来自设备的数组中读取有符号 32 位整数。 |
static
void
|
swap32bitsToArray(int value, byte[] dest, int offset)
交换无符号值,并将结果放入可发送到设备的数组中。 |
static
long
|
swap64bitFromArray(byte[] value, int offset)
从来自设备的数组中读取有符号的 64 位整数。 |
static
int
|
swapU16bitFromArray(byte[] value, int offset)
从来自设备的数组中读取一个无符号 16 位整数,并将其作为“int”返回 |
公共构造函数
ArrayHelper
public ArrayHelper ()
公共方法
swap32bitFromArray
public static int swap32bitFromArray (byte[] value,
int offset)从来自设备的数组中读取有符号 32 位整数。
| 参数 | |
|---|---|
value |
byte:包含整数的数组 |
offset |
int:数组中 int 的起始偏移量 |
| 返回 | |
|---|---|
int |
从数组中读取的整数 |
swap32bitsToArray
public static void swap32bitsToArray (int value,
byte[] dest,
int offset)交换无符号值,并将结果放入可发送到设备的数组中。
| 参数 | |
|---|---|
value |
int:要交换的值。 |
dest |
byte:目标数组 |
offset |
int:数组中放置交换值的偏移量。数组长度必须至少为 offset + 4 |
swap64bitFromArray
public static long swap64bitFromArray (byte[] value,
int offset)从来自设备的数组中读取有符号的 64 位整数。
| 参数 | |
|---|---|
value |
byte:包含整数的数组 |
offset |
int:数组中整数的起始偏移量。数组长度必须至少为 offset + 8 |
| 返回 | |
|---|---|
long |
从数组中读取的整数 |
swapU16bitFromArray
public static int swapU16bitFromArray (byte[] value,
int offset)从来自设备的数组中读取一个无符号 16 位整数,并将其作为“int”返回
| 参数 | |
|---|---|
value |
byte:包含 16 位整数(2 字节)的数组。 |
offset |
int:数组中 int 的起始偏移量。数组长度必须至少为 offset + 2 |
| 返回 | |
|---|---|
int |
从数组中读取的整数。 |