public class DataConvert extends Object
| 构造器 | 说明 |
|---|---|
DataConvert() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static byte[] |
bigToLittle(byte[] bytes) |
Convert BigEndian to LittleEndian
|
static int |
byte2Int(byte b) |
Convert byte to int - byte in Java is signed
|
static double |
bytes2Double(byte[] b,
ByteOrder byteOrder) |
Byte array convert to double
|
static float |
bytes2Float(byte[] b,
ByteOrder byteOrder) |
Byte array convert to float
|
static int |
bytes2Int(byte[] bytes) |
Byte array convert to integer
|
static int |
bytes2Int(byte[] bytes,
ByteOrder byteOrder) |
Byte array convert to integer
|
static int |
bytes2Int3(byte[] bytes) |
Byte array (3 bytes) convert to integer
|
static short |
bytes2Short(byte[] bytes,
ByteOrder byteOrder) |
Byte array convert to short integer
|
static Object |
convertStringTo(String vStr,
ucar.ma2.DataType dataType,
String dateFormat) |
Convert input string data to current data type
|
static Object |
convertTo(Object value,
ucar.ma2.DataType dataType,
String dateFormat) |
Convert input data to current data type
|
static ucar.ma2.DataType |
detectDataType(List<String> valuesList,
int n,
org.joda.time.format.DateTimeFormatter dtFormatter) |
Detect data type
|
static ucar.ma2.DataType |
detectDataType(List<String> valuesList,
org.joda.time.format.DateTimeFormatter dtFormatter) |
Detect data type
|
static String |
doubleToString(double v) |
Double to string
|
static byte[] |
float2Bytes(float f,
ByteOrder byteOrder) |
Convert float to byte array
|
static ucar.ma2.DataType |
getDataType(String format) |
Get data type
|
static String |
getDateFormat(String format) |
Get date format string
|
static boolean |
isBoolean(String s) |
Check a string is boolean or not
|
static boolean |
isDouble(String s) |
Check a string is double or not
|
static boolean |
isFloat(String s) |
Check a string is float or not
|
static boolean |
isInteger(String s) |
Check a string is integer or not
|
static boolean |
isLocalDate(String s,
org.joda.time.format.DateTimeFormatter dateTimeFormatter) |
Check a string is local date or not
|
static boolean |
isLocalDateTime(String s,
org.joda.time.format.DateTimeFormatter formatter) |
Check a string is local date time or not
|
static boolean |
isLocalTime(String s,
org.joda.time.format.DateTimeFormatter formatter) |
Check a string is local time or not
|
static byte[] |
littleToBig(byte[] bytes) |
Convert LittleEndian to BigEndian
|
static String |
removeTail0(String str) |
Remove last zero chars
|
static String |
removeTailingZeros(String s) |
Remove tail zero
|
static Object |
resizeArray(Object oldArray,
int newSize) |
Resize array
|
static double[][] |
resizeArray2D(double[][] oldArray,
int newSize) |
Resize double 2d array
|
static 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 array
|
static byte[] |
toBytes(int i) |
Convert int to byte array.
|
static byte[] |
toLittleBytes(float f) |
Convert float to byte array
|
static byte[] |
toLittleBytes(int i) |
Convert int to byte array - LittleEndian
|
static 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.
|
public static float bytes2Float(byte[] b,
ByteOrder byteOrder)
b - Byte arraybyteOrder - Byte orderpublic static double bytes2Double(byte[] b,
ByteOrder byteOrder)
b - Byte arraybyteOrder - Byte orderpublic static int bytes2Int(byte[] bytes,
ByteOrder byteOrder)
bytes - Byte arraybyteOrder - Byte orderpublic static short bytes2Short(byte[] bytes,
ByteOrder byteOrder)
bytes - Byte arraybyteOrder - Byte orderpublic static int bytes2Int(byte[] bytes)
bytes - byte arraypublic static int bytes2Int3(byte[] bytes)
bytes - Byte arraypublic static int byte2Int(byte b)
b - Input bytepublic static byte[] littleToBig(byte[] bytes)
bytes - Input LittleEndian byte arraypublic static byte[] bigToLittle(byte[] bytes)
bytes - Input BigEndian byte arraypublic static byte[] toBytes(int i)
i - Int valuepublic static byte[] toUint3Int(int i)
i - Int valuepublic static byte[] toUint2Int(int i)
i - Int valuepublic static byte[] toUintNInt(int i,
int n)
i - Int valuen - bit numberpublic static byte[] toLittleBytes(int i)
i - Int valuepublic static byte[] toBytes(float f)
f - Float valuepublic static byte[] float2Bytes(float f,
ByteOrder byteOrder)
f - Float valuebyteOrder - ByteOrderpublic static byte[] toLittleBytes(float f)
f - Float arraypublic static Object resizeArray(Object oldArray, int newSize)
oldArray - Old arraynewSize - New sizepublic static double[][] resizeArray2D(double[][] oldArray,
int newSize)
oldArray - Old arraynewSize - New sizepublic static String doubleToString(double v)
v - The double valuepublic static String removeTailingZeros(String s)
s - The stringpublic static String removeTail0(String str)
str - Stringpublic static byte[] toByte_bak1(BitSet bits)
public static byte[] toByteArray(BitSet bits)
public static byte[] toByteArray_bak(BitSet bitSet)
public static Object convertTo(Object value, ucar.ma2.DataType dataType, String dateFormat)
value - Data valuedataType - Data typedateFormat - Date formatpublic static Object convertStringTo(String vStr, ucar.ma2.DataType dataType, String dateFormat)
vStr - String valuedataType - Data typedateFormat - Date formatpublic static ucar.ma2.DataType getDataType(String format)
format - Format stringpublic static String getDateFormat(String format)
format - Format stringpublic static boolean isDouble(String s)
s - The stringpublic static boolean isFloat(String s)
s - The stringpublic static boolean isInteger(String s)
s - The stringpublic static boolean isBoolean(String s)
s - The stringpublic static boolean isLocalDate(String s, org.joda.time.format.DateTimeFormatter dateTimeFormatter)
s - The stringdateTimeFormatter - DateTimeFormatterpublic static boolean isLocalTime(String s, org.joda.time.format.DateTimeFormatter formatter)
s - The stringformatter - DateTimeFormatterpublic static boolean isLocalDateTime(String s, org.joda.time.format.DateTimeFormatter formatter)
s - The stringformatter - DateTimeFormatterpublic static ucar.ma2.DataType detectDataType(List<String> valuesList, org.joda.time.format.DateTimeFormatter dtFormatter)
valuesList - Values listdtFormatter - DateIimeFormatterCopyright © 2019. All rights reserved.