FixedSizeEncoder
一个可以将 TFrom 类型的值编码为固定大小的 ReadonlyUint8Array 的对象。
查看 Encoder 以了解更多关于创建和组合编码器的信息。
示例
参见
类型参数
类型参数 | 默认类型 | 描述 |
---|---|---|
TFrom | - | 要编码的值的类型。 |
TSize extends number | number | 编码后的值的大小(以字节为单位)。 |
属性
属性 | 修饰符 | 类型 | 描述 |
---|---|---|---|
encode | readonly | (value ) => ReadonlyUint8Array | 编码提供的值并直接返回编码后的字节。 |
fixedSize | readonly | TSize | 编码后的值的固定大小(以字节为单位)。 |
write | readonly | (value , bytes , offset ) => number | 将编码后的值写入到给定偏移量处的提供的字节数组中。返回编码后的值之后的下一个字节的偏移量。 |