public class Utilities extends Object
| 构造器和说明 |
|---|
Utilities() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Date |
AddDateDays(Date date,
int amount)
将指定的日期时间,增加指定的天数信息
|
static void |
ArrayListAddArray(ArrayList<Boolean> arrayList,
boolean[] booleans)
往列表 arrayList 里添加 bool[] 数组数据
|
static void |
ArrayListAddArray(ArrayList<Byte> arrayList,
byte[] bytes)
往列表 arrayList 里添加 byte[] 数组数据
|
static <T> T[] |
ArrayListToArray(Class<T> tClass,
ArrayList<T> list)
获取ArrayList的数组表示方式
|
static String |
byte2CSharpString(byte[] byteArray)
将字节数组转换成字符串对象,主要转换由C#的字符串的数据
|
static String |
byte2CSharpString(byte[] byteArray,
int index,
int length)
将字节数组转换成字符串对象,主要转换由C#的字符串的数据
|
static String |
byte2CSharpString(byte[] byteArray,
int index,
int length,
String charsetName)
将字节数组转换成字符串对象,主要转换由C#的字符串的数据
|
static String |
byte2CSharpString(byte[] byteArray,
String charsetName)
将字节数组转换成字符串对象,主要转换由C#的字符串的数据
|
static UUID |
Byte2UUID(byte[] data)
将一个byte[]数组转换成uuid对象
|
static void |
ByteArrayCopyTo(byte[] source,
byte[] destination,
int index)
将一个数组拷贝到目标数组里去
|
static String |
bytes2HexString(byte[] bytes)
将字节数组转换成十六进制的字符串形式
|
static void |
bytesReverse(byte[] reverse)
将byte[]数组的数据进行翻转
|
static byte[] |
csharpString2Byte(String str)
将字符串数据转换成字节数组,主要转换由C#的字符串的数据
|
static boolean[] |
getBools(ArrayList<Boolean> data)
将ArrayList数组转换为bool[]数据
|
static byte[] |
getBytes(ArrayList<Byte> data)
将ArrayList数组转换为byte[]数据
|
static byte[] |
getBytes(double data)
将double数据类型转化成Byte数组
|
static byte[] |
getBytes(float data)
将float数据类型转化成Byte数组
|
static byte[] |
getBytes(int data)
将int数据类型转化成Byte数组
|
static byte[] |
getBytes(long data)
将long数据类型转化成Byte数组
|
static byte[] |
getBytes(short data)
将short数据类型转化成Byte数组
|
static byte[] |
getBytes(String data,
String charsetName)
将字符串转换成byte[]数组
|
static double |
getDouble(byte[] bytes,
int index)
将字节数组转换成double数据
|
static float |
getFloat(byte[] bytes,
int index)
将字节数组转换成float数据
|
static int |
getInt(byte[] bytes,
int index)
将字节数组转换成int数据
|
static int |
getIntReverse(byte[] bytes,
int index)
将字节数组转换成int数据,采用倒序的方式
|
static long |
getLong(byte[] bytes,
int index)
将字节数组转换成long数据
|
static long |
getLongReverse(byte[] bytes,
int index)
将字节数组转换成long数据
|
static short |
getShort(byte[] bytes,
int index)
将字节数组转换成short数据
Convert byte array into short data
|
static short |
getShortReverse(byte[] bytes,
int index)
将字节数组转换成short数据,采用倒序的表达方式
Convert byte array into short data in reverse order
|
static String |
getString(byte[] bytes,
int index,
int length,
String charsetName)
将字节数组转换成string数据
|
static String |
getString(byte[] bytes,
String charsetName)
将字节数组转换成string数据
|
static String |
getStringDateShort(Date date,
String format)
获取指定时间的指定格式的字符串
|
static String |
GetStringOrEndChar(byte[] buffer,
int index,
int length,
Charset encoding)
从字节数组里提取字符串数据,如果碰到0x00字节,就直接结束
|
static String[] |
getStrings(ArrayList<String> data)
将ArrayList数组转换为string[]数据
|
static long |
getUInt(byte[] bytes,
int index)
将字节数组转换成uint数据
|
static long |
getUIntReverse(byte[] bytes,
int index)
将字节数组转换成uint数据
|
static int |
getUShort(byte[] bytes,
int index)
将字节数组转换成 ushort 数据
Convert byte array into ushort data
|
static int |
getUShortReverse(byte[] bytes,
int index)
将字节数组转换成 ushort 数据,采用倒序的方式
Convert byte array into ushort data in reverse order
|
static byte |
int2OneByte(int num)
将int转换成一个字节的数据
|
static boolean |
IsStringNullOrEmpty(String string)
判断字符串是否为NULL或是空字符串
|
static int |
oneByte2Int(byte byteNum)
将一个有符号的byte转换成一个int数据对象
|
static String[] |
SplitDot(String str)
将字符串按照 .
|
static byte[][] |
ToArray(ArrayList<byte[]> list)
获取ArrayList的数组表示方式
|
static boolean[] |
ToBoolArray(ArrayList<Boolean> list)
获取ArrayList的数组表示方式
|
static boolean[] |
ToBoolArray(byte[] data)
将byte数组转换为bool[]数据
|
static byte[] |
ToByteArray(ArrayList<Byte> list)
获取ArrayList的数组表示方式
|
static byte[] |
ToByteArray(boolean[] data)
将bool[]数组转换为byte[]数据
|
static <TInput,TResult> |
TranslateArray(Class<TResult> type,
TInput[] input,
java.util.function.Function<TInput,TResult> function)
将输入的数组转换为指定的数组信息
|
static <T> String[] |
TranslateStringArray(T[] input)
将泛型对象转为字符串数组
|
static byte[] |
UUID2Byte(UUID uuid)
将一个uuid对象转化成byte[]
|
public static byte[] getBytes(short data)
data - short值public static byte[] getBytes(int data)
data - int值public static byte[] getBytes(long data)
data - long值public static byte[] getBytes(float data)
data - float值public static byte[] getBytes(double data)
data - double值public static byte[] getBytes(String data, String charsetName)
data - 字符串值charsetName - 编码方式public static byte[] getBytes(ArrayList<Byte> data)
data - 等待转换的数据信息public static String[] getStrings(ArrayList<String> data)
data - 等待转换的数据信息public static byte int2OneByte(int num)
num - int数据public static int oneByte2Int(byte byteNum)
byteNum - 有符号的字节对象public static void ByteArrayCopyTo(byte[] source,
byte[] destination,
int index)
source - 源数组信息destination - 目标数组信息index - 索引开始的地址public static short getShort(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static short getShortReverse(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static int getUShort(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static int getUShortReverse(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static int getInt(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static long getUInt(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static int getIntReverse(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static long getUIntReverse(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static boolean[] getBools(ArrayList<Boolean> data)
data - 等待转换的数据信息public static long getLong(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static long getLongReverse(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static float getFloat(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static double getDouble(byte[] bytes,
int index)
bytes - 字节数组index - 起始位置public static String getString(byte[] bytes, String charsetName)
bytes - 字节数组charsetName - 字符编码public static String getString(byte[] bytes, int index, int length, String charsetName)
bytes - 字节数组index - 起始位置length - 数据长度charsetName - 字符编码public static String GetStringOrEndChar(byte[] buffer, int index, int length, Charset encoding)
buffer - 原始字节信息index - 起始的偏移地址length - 字节长度信息encoding - 编码public static UUID Byte2UUID(byte[] data)
data - 字节数组public static byte[] UUID2Byte(UUID uuid)
uuid - uuid对象public static byte[][] ToArray(ArrayList<byte[]> list)
list - 数组public static <T> T[] ArrayListToArray(Class<T> tClass, ArrayList<T> list)
T - 泛型类型tClass - 类型信息list - 数组对象public static byte[] ToByteArray(ArrayList<Byte> list)
list - 数组public static boolean[] ToBoolArray(ArrayList<Boolean> list)
list - 数组public static byte[] ToByteArray(boolean[] data)
data - 等待转换的数据信息public static boolean[] ToBoolArray(byte[] data)
data - 等待转换的数据信息public static byte[] csharpString2Byte(String str)
str - 字符串信息public static String byte2CSharpString(byte[] byteArray)
byteArray - 缓存数据public static String byte2CSharpString(byte[] byteArray, String charsetName)
byteArray - 缓存数据charsetName - 编码信息public static String byte2CSharpString(byte[] byteArray, int index, int length)
byteArray - 缓存数据public static String byte2CSharpString(byte[] byteArray, int index, int length, String charsetName)
byteArray - 缓存数据index - 起始的位置length - 长度charsetName - 编码public static void bytesReverse(byte[] reverse)
reverse - 等待反转的字符串public static void ArrayListAddArray(ArrayList<Byte> arrayList, byte[] bytes)
arrayList - 数组信息bytes - 实际的数据public static void ArrayListAddArray(ArrayList<Boolean> arrayList, boolean[] booleans)
arrayList - 数组信息booleans - 实际的数据public static String bytes2HexString(byte[] bytes)
bytes - 原始的字节数组public static String getStringDateShort(Date date, String format)
date - 指定的时间format - 指定的格式public static boolean IsStringNullOrEmpty(String string)
string - 字符串public static Date AddDateDays(Date date, int amount)
date - 指定的日期时间amount - 增加的天数信息public static String[] SplitDot(String str)
str - 字符串信息public static <TInput,TResult> TResult[] TranslateArray(Class<TResult> type, TInput[] input, java.util.function.Function<TInput,TResult> function)
TInput - 输入类型TResult - 输出类型type - 结果类型input - 输入数组function - 转换方法public static <T> String[] TranslateStringArray(T[] input)
T - 输入的类型input - 输入的对象Copyright © 2022. All rights reserved.