public class ByteTransformBase extends Object implements IByteTransform
DataFormat 的顺序,和C#的字节顺序是一致的。DataFormat is consistent with the byte order of C#.| 构造器和说明 |
|---|
ByteTransformBase()
实例化一个默认的对象
Instantiate a default object |
ByteTransformBase(DataFormat dataFormat)
使用指定的数据解析来实例化对象
Instantiate the object using the specified data parsing |
| 限定符和类型 | 方法和说明 |
|---|---|
protected byte[] |
ByteTransDataFormat4(byte[] value)
反转多字节的数据信息
|
protected byte[] |
ByteTransDataFormat4(byte[] value,
int Index)
反转多字节的数据信息
|
protected byte[] |
ByteTransDataFormat8(byte[] value)
反转多字节的数据信息
|
protected byte[] |
ByteTransDataFormat8(byte[] value,
int Index)
反转多字节的数据信息
|
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 |
String |
toString() |
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 字节。
|
public ByteTransformBase()
public ByteTransformBase(DataFormat dataFormat)
public boolean TransBool(byte[] buffer,
int index)
IByteTransformTransBool 在接口中 IByteTransformbuffer - 缓存数据index - 位的索引,注意:是从0开始的位索引,10则表示 buffer[1] 的第二位。public boolean[] TransBool(byte[] buffer,
int index,
int length)
IByteTransformTransBool 在接口中 IByteTransformbuffer - 缓存数据index - 位的索引length - bool长度public byte TransByte(byte[] buffer,
int index)
IByteTransformTransByte 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置public byte[] TransByte(byte[] buffer,
int index,
int length)
IByteTransformTransByte 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置length - 读取的数组长度public short TransInt16(byte[] buffer,
int index)
IByteTransformTransInt16 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置public short[] TransInt16(byte[] buffer,
int index,
int length)
IByteTransformTransInt16 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置length - 读取的数组长度public int TransUInt16(byte[] buffer,
int index)
IByteTransformTransUInt16 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置public int[] TransUInt16(byte[] buffer,
int index,
int length)
IByteTransformTransUInt16 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置length - 读取的数组长度public int TransInt32(byte[] buffer,
int index)
IByteTransformTransInt32 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置public int[] TransInt32(byte[] buffer,
int index,
int length)
IByteTransformTransInt32 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置length - 读取的数组长度public long TransUInt32(byte[] buffer,
int index)
IByteTransformTransUInt32 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置public long[] TransUInt32(byte[] buffer,
int index,
int length)
IByteTransformTransUInt32 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置length - 读取的数组长度public long TransInt64(byte[] buffer,
int index)
IByteTransformTransInt64 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置public long[] TransInt64(byte[] buffer,
int index,
int length)
IByteTransformTransInt64 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置length - 读取的数组长度public float TransSingle(byte[] buffer,
int index)
IByteTransformTransSingle 在接口中 IByteTransformbuffer - 缓存对象index - 索引位置public float[] TransSingle(byte[] buffer,
int index,
int length)
IByteTransformTransSingle 在接口中 IByteTransformbuffer - 缓存数据index - 索引位置length - 读取的数组长度public double TransDouble(byte[] buffer,
int index)
IByteTransformTransDouble 在接口中 IByteTransformbuffer - 缓存对象index - 索引位置public double[] TransDouble(byte[] buffer,
int index,
int length)
IByteTransformTransDouble 在接口中 IByteTransformbuffer - 缓存对象index - 索引位置length - 读取的数组长度public String TransString(byte[] buffer, int index, int length, Charset encoding)
IByteTransformTransString 在接口中 IByteTransformbuffer - 缓存对象index - 索引位置length - byte数组长度encoding - 字符串的编码public byte[] TransByte(boolean value)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据public byte[] TransByte(boolean[] values)
IByteTransformTransByte 在接口中 IByteTransformvalues - 等待转化的数组public byte[] TransByte(byte value)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据public byte[] TransByte(short value)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据public byte[] TransByte(short[] values)
IByteTransformTransByte 在接口中 IByteTransformvalues - 等待转化的数组public byte[] TransByte(int value)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据public byte[] TransByte(int[] values)
IByteTransformTransByte 在接口中 IByteTransformvalues - 等待转化的数组public byte[] TransByte(long value)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据public byte[] TransByte(long[] values)
IByteTransformTransByte 在接口中 IByteTransformvalues - 等待转化的数组public byte[] TransByte(float value)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据public byte[] TransByte(float[] values)
IByteTransformTransByte 在接口中 IByteTransformvalues - 等待转化的数组public byte[] TransByte(double value)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据public byte[] TransByte(double[] values)
IByteTransformTransByte 在接口中 IByteTransformvalues - 等待转化的数组public byte[] TransByte(String value, Charset encoding)
IByteTransformTransByte 在接口中 IByteTransformvalue - 等待转化的数据encoding - 字符串的编码方式public boolean getIsStringReverse()
IByteTransformgetIsStringReverse 在接口中 IByteTransformpublic void setIsStringReverse(boolean value)
IByteTransformsetIsStringReverse 在接口中 IByteTransformvalue - 设置值public void setDataFormat(DataFormat dataFormat)
IByteTransformsetDataFormat 在接口中 IByteTransformdataFormat - 数据格式public DataFormat getDataFormat()
IByteTransformgetDataFormat 在接口中 IByteTransformprotected byte[] ByteTransDataFormat4(byte[] value,
int Index)
value - 数据字节Index - 起始索引,默认值为0protected byte[] ByteTransDataFormat4(byte[] value)
value - 数据字节protected byte[] ByteTransDataFormat8(byte[] value,
int Index)
value - 数据字节Index - 起始索引,默认值为0protected byte[] ByteTransDataFormat8(byte[] value)
value - 数据字节public IByteTransform CreateByDateFormat(DataFormat dataFormat)
IByteTransformDataFormat 格式,来实例化一个新的对象,除了DataFormat不同,其他都相同DataFormat format, to instantiate a new object, except that DataFormat is different, everything else is the sameCreateByDateFormat 在接口中 IByteTransformdataFormat - 数据格式Copyright © 2022. All rights reserved.