类 DataConvert
- java.lang.Object
-
- org.meteoinfo.common.DataConvert
-
public class DataConvert extends Object
- 作者:
- Yaqiang Wang
-
-
构造器概要
构造器 构造器 说明 DataConvert()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static byte[]bigToLittle(byte[] bytes)Convert BigEndian to LittleEndianstatic intbyte2Int(byte b)Convert byte to int - byte in Java is signedstatic doublebytes2Double(byte[] b, ByteOrder byteOrder)Byte array convert to doublestatic floatbytes2Float(byte[] b, ByteOrder byteOrder)Byte array convert to floatstatic intbytes2Int(byte[] bytes)Byte array convert to integerstatic intbytes2Int(byte[] bytes, ByteOrder byteOrder)Byte array convert to integerstatic intbytes2Int2(byte[] bytes)Byte array (2 bytes) convert to integerstatic intbytes2Int3(byte[] bytes)Byte array (3 bytes) convert to integerstatic Longbytes2Long(byte[] bytes, ByteOrder byteOrder)Byte array convert to long integerstatic shortbytes2Short(byte[] bytes)Byte array convert to short integerstatic shortbytes2Short(byte[] bytes, ByteOrder byteOrder)Byte array convert to short integerstatic intbytes2UShort(byte[] bytes)Byte array convert to unsigned short integerstatic intbytes2UShort(byte[] bytes, ByteOrder byteOrder)Byte array convert to unsigned short integerstatic StringdoubleToString(double v)Double to stringstatic byte[]float2Bytes(float f, ByteOrder byteOrder)Convert float to byte arraystatic StringgetDateFormat(String format)Get date format stringstatic booleanisBoolean(String s)Check a string is boolean or notstatic booleanisDouble(String s)Check a string is double or notstatic booleanisFloat(String s)Check a string is float or notstatic booleanisInteger(String s)Check a string is integer or notstatic booleanisLocalDate(String s, DateTimeFormatter dateTimeFormatter)Check a string is local date or notstatic booleanisLocalDateTime(String s, DateTimeFormatter formatter)Check a string is local date time or notstatic booleanisLocalTime(String s, DateTimeFormatter formatter)Check a string is local time or notstatic byte[]littleToBig(byte[] bytes)Convert LittleEndian to BigEndianstatic StringremoveTail0(String str)Remove last zero charsstatic StringremoveTailingZeros(String s)Remove tail zerostatic ObjectresizeArray(Object oldArray, int newSize)Resize arraystatic double[][]resizeArray2D(double[][] oldArray, int newSize)Resize double 2d arraystatic byte[]toByte_bak1(BitSet bits)static byte[]toByteArray(BitSet bits)static byte[]toByteArray_bak(BitSet bitSet)static byte[]toBytes(float f)Convert float to byte arraystatic byte[]toBytes(int i)Convert int to byte array.static byte[]toLittleBytes(float f)Convert float to byte arraystatic byte[]toLittleBytes(int i)Convert int to byte array - LittleEndianstatic byte[]toUint2Int(int i)Convert int to 2 byte array.static byte[]toUint3Int(int i)Convert int to 3 byte array.static byte[]toUintNInt(int i, int n)Convert int to N byte array.
-
-
-
方法详细资料
-
bytes2Float
public static float bytes2Float(byte[] b, ByteOrder byteOrder)Byte array convert to float- 参数:
b- Byte arraybyteOrder- Byte order- 返回:
- Float value
-
bytes2Double
public static double bytes2Double(byte[] b, ByteOrder byteOrder)Byte array convert to double- 参数:
b- Byte arraybyteOrder- Byte order- 返回:
- Double value
-
bytes2Int
public static int bytes2Int(byte[] bytes, ByteOrder byteOrder)Byte array convert to integer- 参数:
bytes- Byte arraybyteOrder- Byte order- 返回:
- Integer value
-
bytes2Short
public static short bytes2Short(byte[] bytes, ByteOrder byteOrder)Byte array convert to short integer- 参数:
bytes- Byte arraybyteOrder- Byte order- 返回:
- Short integer value
-
bytes2Short
public static short bytes2Short(byte[] bytes)
Byte array convert to short integer- 参数:
bytes- Byte array- 返回:
- Short integer value
-
bytes2UShort
public static int bytes2UShort(byte[] bytes)
Byte array convert to unsigned short integer- 参数:
bytes- Byte array- 返回:
- Unsigned short integer value
-
bytes2UShort
public static int bytes2UShort(byte[] bytes, ByteOrder byteOrder)Byte array convert to unsigned short integer- 参数:
bytes- Byte arraybyteOrder- Byte order- 返回:
- Unsigned short integer value
-
bytes2Long
public static Long bytes2Long(byte[] bytes, ByteOrder byteOrder)
Byte array convert to long integer- 参数:
bytes- Byte arraybyteOrder- Byte order- 返回:
- Long integer value
-
bytes2Int
public static int bytes2Int(byte[] bytes)
Byte array convert to integer- 参数:
bytes- byte array- 返回:
- Integer value
-
bytes2Int2
public static int bytes2Int2(byte[] bytes)
Byte array (2 bytes) convert to integer- 参数:
bytes- byte array- 返回:
- Integer value
-
bytes2Int3
public static int bytes2Int3(byte[] bytes)
Byte array (3 bytes) convert to integer- 参数:
bytes- Byte array- 返回:
- Integer value
-
byte2Int
public static int byte2Int(byte b)
Convert byte to int - byte in Java is signed- 参数:
b- Input byte- 返回:
- Output integer
-
littleToBig
public static byte[] littleToBig(byte[] bytes)
Convert LittleEndian to BigEndian- 参数:
bytes- Input LittleEndian byte array- 返回:
- Output BigEndian byte array
-
bigToLittle
public static byte[] bigToLittle(byte[] bytes)
Convert BigEndian to LittleEndian- 参数:
bytes- Input BigEndian byte array- 返回:
- Output LittleEndian byte array
-
toBytes
public static byte[] toBytes(int i)
Convert int to byte array.- 参数:
i- Int value- 返回:
- Byte array
-
toUint3Int
public static byte[] toUint3Int(int i)
Convert int to 3 byte array.- 参数:
i- Int value- 返回:
- Byte array
-
toUint2Int
public static byte[] toUint2Int(int i)
Convert int to 2 byte array.- 参数:
i- Int value- 返回:
- Byte array
-
toUintNInt
public static byte[] toUintNInt(int i, int n)Convert int to N byte array.- 参数:
i- Int valuen- bit number- 返回:
- Byte array
-
toLittleBytes
public static byte[] toLittleBytes(int i)
Convert int to byte array - LittleEndian- 参数:
i- Int value- 返回:
- Byte array
-
toBytes
public static byte[] toBytes(float f)
Convert float to byte array- 参数:
f- Float value- 返回:
- Byte array
-
float2Bytes
public static byte[] float2Bytes(float f, ByteOrder byteOrder)Convert float to byte array- 参数:
f- Float valuebyteOrder- ByteOrder- 返回:
- Byte array
-
toLittleBytes
public static byte[] toLittleBytes(float f)
Convert float to byte array- 参数:
f- Float array- 返回:
- Byte array
-
resizeArray
public static Object resizeArray(Object oldArray, int newSize)
Resize array- 参数:
oldArray- Old arraynewSize- New size- 返回:
- Resized array
-
resizeArray2D
public static double[][] resizeArray2D(double[][] oldArray, int newSize)Resize double 2d array- 参数:
oldArray- Old arraynewSize- New size- 返回:
- Resized array
-
doubleToString
public static String doubleToString(double v)
Double to string- 参数:
v- The double value- 返回:
- Result string
-
removeTailingZeros
public static String removeTailingZeros(String s)
Remove tail zero- 参数:
s- The string- 返回:
- Result string
-
removeTail0
public static String removeTail0(String str)
Remove last zero chars- 参数:
str- String- 返回:
- Result string
-
toByte_bak1
public static byte[] toByte_bak1(BitSet bits)
-
toByteArray
public static byte[] toByteArray(BitSet bits)
-
toByteArray_bak
public static byte[] toByteArray_bak(BitSet bitSet)
-
getDateFormat
public static String getDateFormat(String format)
Get date format string- 参数:
format- Format string- 返回:
- Date format string
-
isDouble
public static boolean isDouble(String s)
Check a string is double or not- 参数:
s- The string- 返回:
- Boolean
-
isFloat
public static boolean isFloat(String s)
Check a string is float or not- 参数:
s- The string- 返回:
- Boolean
-
isInteger
public static boolean isInteger(String s)
Check a string is integer or not- 参数:
s- The string- 返回:
- Boolean
-
isBoolean
public static boolean isBoolean(String s)
Check a string is boolean or not- 参数:
s- The string- 返回:
- Boolean
-
isLocalDate
public static boolean isLocalDate(String s, DateTimeFormatter dateTimeFormatter)
Check a string is local date or not- 参数:
s- The stringdateTimeFormatter- DateTimeFormatter- 返回:
-
isLocalTime
public static boolean isLocalTime(String s, DateTimeFormatter formatter)
Check a string is local time or not- 参数:
s- The stringformatter- DateTimeFormatter- 返回:
-
isLocalDateTime
public static boolean isLocalDateTime(String s, DateTimeFormatter formatter)
Check a string is local date time or not- 参数:
s- The stringformatter- DateTimeFormatter- 返回:
-
-