public interface IByteTransform
| 限定符和类型 | 方法和说明 |
|---|---|
IByteTransform |
CreateByDateFormat(DataFormat dataFormat)
根据指定的
DataFormat 格式,来实例化一个新的对象,除了DataFormat不同,其他都相同ccording to the specified DataFormat format, to instantiate a new object, except that DataFormat is different, everything else is the same |
DataFormat |
getDataFormat()
获取数据解析的格式,可选ABCD, BADC,CDAB,DCBA格式,对int,uint,float,double,long,ulong类型有作用
Get the format of the data analysis, optional ABCD, BADC, CDAB, DCBA format, effective for int, uint, float, double, long, ulong type
|
boolean |
getIsStringReverse()
获取在解析字符串的时候是否将字节按照字单位反转
Gets whether to reverse the bytes in word units when parsing strings |
void |
setDataFormat(DataFormat dataFormat)
设置数据解析的格式,可选ABCD, BADC,CDAB,DCBA格式,对int,uint,float,double,long,ulong类型有作用
Set the format of the data analysis, optional ABCD, BADC, CDAB, DCBA format, effective for int, uint, float, double, long, ulong type
|
void |
setIsStringReverse(boolean value)
设置在解析字符串的时候是否将字节按照字单位反转
Sets whether to reverse the bytes in word units when parsing strings |
boolean |
TransBool(byte[] buffer,
int index)
从缓存中提取出bool结果,需要传入想要提取的位索引,注意:是从0开始的位索引,10则表示 buffer[1] 的第二位。
|
boolean[] |
TransBool(byte[] buffer,
int index,
int length)
从缓存中提取出bool数组结果,需要传入想要提取的位索引,注意:是从0开始的位索引,10则表示 buffer[1] 的第二位。
|
byte[] |
TransByte(boolean value)
bool变量转化缓存数据,一般来说单bool只能转化为0x01 或是 0x00
The bool variable is converted to cache data, a single bool can only be converted to 0x01 or 0x00 |
byte[] |
TransByte(boolean[] values)
将bool数组变量转化缓存数据,如果数组长度不满足8的倍数,则自动补0操作。
|
byte[] |
TransByte(byte value)
将byte变量转化缓存数据
Convert byte variables into cached data |
byte |
TransByte(byte[] buffer,
int index)
从缓存中提取byte结果,需要指定起始的字节索引
To extract the byte result from the cache, you need to specify the starting byte index |
byte[] |
TransByte(byte[] buffer,
int index,
int length)
从缓存中提取byte数组结果,需要指定起始的字节索引,以及指定读取的字节长度
To extract the byte array result from the cache, you need to specify the starting byte index and the byte length to be read |
byte[] |
TransByte(double value)
double变量转化缓存数据,一个double数据可以转为8个字节的byte数组
The double variable is converted to cache data, a double data can be converted into an 8-byte byte array |
byte[] |
TransByte(double[] values)
double数组变量转化缓存数据,n个长度的double数组,可以转为8*n个长度的byte数组
The double array variable transforms the buffer data, the double array of n length can be converted to the byte array of 8*n length |
byte[] |
TransByte(float value)
float变量转化缓存数据,一个float数据可以转为4个字节的byte数组
Float variable is converted into cache data, a float data can be converted into a 4-byte byte array |
byte[] |
TransByte(float[] values)
float数组变量转化缓存数据,n个长度的float数组,可以转为4*n个长度的byte数组
Float array variable converts buffer data, n-length float array can be converted into 4*n-length byte array |
byte[] |
TransByte(int value)
int变量转化缓存数据,一个int数据可以转为4个字节的byte数组
Int variable converts cache data, an int data can be converted into a 4-byte byte array |
byte[] |
TransByte(int[] values)
int数组变量转化缓存数据,n个长度的int数组,可以转为4*n个长度的byte数组
The int array variable transforms the cache data, the int array of n length can be converted to the byte array of 4*n length |
byte[] |
TransByte(long value)
long变量转化缓存数据,一个long数据可以转为8个字节的byte数组
Long variable is converted into cache data, a long data can be converted into 8-byte byte array |
byte[] |
TransByte(long[] values)
long数组变量转化缓存数据,n个长度的long数组,可以转为8*n个长度的byte数组
The long array variable transforms the buffer data, the long array of n length can be converted into the byte array of 8*n length |
byte[] |
TransByte(short value)
short变量转化缓存数据,一个short数据可以转为2个字节的byte数组
Short variable is converted to cache data, a short data can be converted into a 2-byte byte array |
byte[] |
TransByte(short[] values)
short数组变量转化缓存数据,n个长度的short数组,可以转为2*n个长度的byte数组
The short array variable transforms the buffered data, a short array of n lengths can be converted into a byte array of 2*n lengths |
byte[] |
TransByte(String value,
Charset encoding)
使用指定的编码字符串转化缓存数据
Use the specified encoding string to convert the cached data |
double |
TransDouble(byte[] buffer,
int index)
从缓存中提取double结果,需要指定起始的字节索引,按照字节为单位,一个double占用八个字节
To extract the double result from the cache, you need to specify the starting byte index, in bytes, A double occupies eight bytes |
double[] |
TransDouble(byte[] buffer,
int index,
int length)
从缓存中提取double数组结果,需要指定起始的字节索引,按照字节为单位,然后指定提取的 double 数组的长度,如果传入 10 ,则表示提取 10 个连续的 double 数据,该数据共占用 80 字节。
|
short |
TransInt16(byte[] buffer,
int index)
从缓存中提取short结果,需要指定起始的字节索引,按照字节为单位,一个short占用两个字节
To extract short results from the cache, you need to specify the starting byte index, in bytes, A short occupies two bytes |
short[] |
TransInt16(byte[] buffer,
int index,
int length)
从缓存中提取short数组结果,需要指定起始的字节索引,按照字节为单位,然后指定提取的 short 数组的长度,如果传入 10 ,则表示提取 10 个连续的 short 数据,该数据共占用 20 字节。
|
int |
TransInt32(byte[] buffer,
int index)
从缓存中提取int结果,需要指定起始的字节索引,按照字节为单位,一个int占用四个字节
To extract the int result from the cache, you need to specify the starting byte index, in bytes, A int occupies four bytes |
int[] |
TransInt32(byte[] buffer,
int index,
int length)
从缓存中提取int数组结果,需要指定起始的字节索引,按照字节为单位,然后指定提取的 int 数组的长度,如果传入 10 ,则表示提取 10 个连续的 int 数据,该数据共占用 40 字节。
|
long |
TransInt64(byte[] buffer,
int index)
从缓存中提取long结果,需要指定起始的字节索引,按照字节为单位,一个long占用八个字节
To extract the long result from the cache, you need to specify the starting byte index, in bytes, A long occupies eight bytes |
long[] |
TransInt64(byte[] buffer,
int index,
int length)
从缓存中提取long数组结果,需要指定起始的字节索引,按照字节为单位,然后指定提取的 long 数组的长度,如果传入 10 ,则表示提取 10 个连续的 long 数据,该数据共占用 80 字节。
|
float |
TransSingle(byte[] buffer,
int index)
从缓存中提取float结果,需要指定起始的字节索引,按照字节为单位,一个float占用四个字节
To extract the float result from the cache, you need to specify the starting byte index, in units of bytes, A float occupies four bytes
|
float[] |
TransSingle(byte[] buffer,
int index,
int length)
从缓存中提取float数组结果,需要指定起始的字节索引,按照字节为单位,然后指定提取的 float 数组的长度,如果传入 10 ,则表示提取 10 个连续的 float 数据,该数据共占用 40 字节。
|
String |
TransString(byte[] buffer,
int index,
int length,
Charset encoding)
从缓存中提取string结果,使用指定的编码将全部的缓存转为字符串
Extract the string result from the cache, use the specified encoding to convert all the cache into a string |
int |
TransUInt16(byte[] buffer,
int index)
从缓存中提取ushort结果,需要指定起始的字节索引,按照字节为单位,一个ushort占用两个字节
To extract ushort results from the cache, you need to specify the starting byte index, in bytes, A ushort occupies two bytes |
int[] |
TransUInt16(byte[] buffer,
int index,
int length)
从缓存中提取ushort数组结果,需要指定起始的字节索引,按照字节为单位,然后指定提取的 ushort 数组的长度,如果传入 10 ,则表示提取 10 个连续的 ushort 数据,该数据共占用 20 字节。
|
long |
TransUInt32(byte[] buffer,
int index)
从缓存中提取uint结果,需要指定起始的字节索引,按照字节为单位,一个uint占用四个字节
To extract uint results from the cache, you need to specify the starting byte index, in bytes, A uint occupies four bytes |
long[] |
TransUInt32(byte[] buffer,
int index,
int length)
从缓存中提取uint数组结果,需要指定起始的字节索引,按照字节为单位,然后指定提取的 uint 数组的长度,如果传入 10 ,则表示提取 10 个连续的 uint 数据,该数据共占用 40 字节。
|
boolean TransBool(byte[] buffer,
int index)
buffer - 缓存数据index - 位的索引,注意:是从0开始的位索引,10则表示 buffer[1] 的第二位。boolean[] TransBool(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 位的索引length - bool长度byte TransByte(byte[] buffer,
int index)
buffer - 缓存数据index - 索引位置byte[] TransByte(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 索引位置length - 读取的数组长度short TransInt16(byte[] buffer,
int index)
buffer - 缓存数据index - 索引位置short[] TransInt16(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 索引位置length - 读取的数组长度int TransUInt16(byte[] buffer,
int index)
buffer - 缓存数据index - 索引位置int[] TransUInt16(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 索引位置length - 读取的数组长度int TransInt32(byte[] buffer,
int index)
buffer - 缓存数据index - 索引位置int[] TransInt32(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 索引位置length - 读取的数组长度long TransUInt32(byte[] buffer,
int index)
buffer - 缓存数据index - 索引位置long[] TransUInt32(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 索引位置length - 读取的数组长度long TransInt64(byte[] buffer,
int index)
buffer - 缓存数据index - 索引位置long[] TransInt64(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 索引位置length - 读取的数组长度float TransSingle(byte[] buffer,
int index)
buffer - 缓存对象index - 索引位置float[] TransSingle(byte[] buffer,
int index,
int length)
buffer - 缓存数据index - 索引位置length - 读取的数组长度double TransDouble(byte[] buffer,
int index)
buffer - 缓存对象index - 索引位置double[] TransDouble(byte[] buffer,
int index,
int length)
buffer - 缓存对象index - 索引位置length - 读取的数组长度String TransString(byte[] buffer, int index, int length, Charset encoding)
buffer - 缓存对象index - 索引位置length - byte数组长度encoding - 字符串的编码byte[] TransByte(boolean value)
value - 等待转化的数据byte[] TransByte(boolean[] values)
values - 等待转化的数组byte[] TransByte(byte value)
value - 等待转化的数据byte[] TransByte(short value)
value - 等待转化的数据byte[] TransByte(short[] values)
values - 等待转化的数组byte[] TransByte(int value)
value - 等待转化的数据byte[] TransByte(int[] values)
values - 等待转化的数组byte[] TransByte(long value)
value - 等待转化的数据byte[] TransByte(long[] values)
values - 等待转化的数组byte[] TransByte(float value)
value - 等待转化的数据byte[] TransByte(float[] values)
values - 等待转化的数组byte[] TransByte(double value)
value - 等待转化的数据byte[] TransByte(double[] values)
values - 等待转化的数组byte[] TransByte(String value, Charset encoding)
value - 等待转化的数据encoding - 字符串的编码方式void setDataFormat(DataFormat dataFormat)
dataFormat - 数据格式DataFormat getDataFormat()
boolean getIsStringReverse()
void setIsStringReverse(boolean value)
value - 设置值IByteTransform CreateByDateFormat(DataFormat dataFormat)
DataFormat 格式,来实例化一个新的对象,除了DataFormat不同,其他都相同DataFormat format, to instantiate a new object, except that DataFormat is different, everything else is the samedataFormat - 数据格式Copyright © 2022. All rights reserved.