可选
data: anySpecifies the number of elements for initialization, or a TypedArray object or ArrayBuffer object for initialization. If null, allocate a certain amount of memory in advance. When available space is not enough, use this part of the memory first, and reallocate the required memory if it is still not enough.
静态
只读
BIG_Host byte order, which represents the two different sequences in which a CPU can store data: little-endian and big-endian. Use getSystemEndian to obtain the byte order of the current system. BIG_ENDIAN byte order: The lower address stores, the higher bits of the value, and the higher address stores the lower bits. It is sometimes referred to as network byte order. LITTLE_ENDIAN byte order: The lower address stores, the lower bits of the value, and the higher address stores the higher bits.
静态
只读
LITTLE_Host byte order, which represents the two different sequences in which a CPU can store data: little-endian and big-endian. Use getSystemEndian to obtain the byte order of the current system. LITTLE_ENDIAN byte order: The lower address stores the lower bits of the value, and the higher address stores the higher bits. BIG_ENDIAN byte order: The lower address stores the higher bits of the value, and the higher address stores the lower bits. It is sometimes referred to as network byte order.
The byte order of the Byte
instance. Possible values are BIG_ENDIAN
or LITTLE_ENDIAN
.
The host byte order is one of two sequences used by the CPU to store data, which includes little-endian and big-endian byte orders.The current system's byte order can be obtained using getSystemEndian
.
BIG_ENDIAN
: Big-endian byte order, where the lower memory address stores the higher-order bits of a number, and is sometimes referred to as network byte order.
LITTLE_ENDIAN
: Little-endian byte order, where the lower memory address stores the lower-order bits of a number.
The length of the Byte
object, measured in bytes.
When setting the length to a value greater than the current length, the byte array is right-padded with zeros. If the length is set to a value less than the current length, the byte array is truncated.
If the length to be set exceeds the current allocated memory space, the memory is reallocated to the larger of either the new length or twice the current allocated length, and the original data is copied to the new memory space. If the length to be set is less than the current allocated memory space, the memory is reallocated to the new length, and the original data is truncated from the beginning to fit the new length.
The ArrayBuffer object to write from.
可选
offset: numberThe offset index of the ArrayBuffer object (in bytes).
可选
length: numberThe length to write from the ArrayBuffer object into the Byte object (in bytes).
Writes a byte sequence from the specified arraybuffer object into the byte stream, starting at the offset and with the specified length. If the length parameter is omitted, the default length of 0 is used, and the method writes the entire buffer from the offset, if the offset is also omitted, the entire buffer is written. The function will throw an exception if the offset or length is less than 0.
静态
getThe byte order of the current system.
Get the byte order of the current host. The host byte order refers to the two different sequences in which a CPU stores data, which includes little-endian and big-endian. BIG_ENDIAN: Big-endian byte order, where the lower address stores the higher bits of the value, and the higher address stores the lower bits. It is sometimes also called network byte order. LITTLE_ENDIAN: Little-endian byte order, where the lower address stores the lower bits of the value, and the higher address stores the higher bits.
En
The Byte class provides methods and properties for optimizing the reading, writing, and handling of binary data. The Byte class is suitable for advanced developers who need to access data at the byte level.
Zh
Byte 类提供用于优化读取、写入以及处理二进制数据的方法和属性。Byte 类适用于需要在字节层访问数据的高级开发人员。