BitString
概述
BitString 是 Aspose.PDF FOSS 中用于 .NET 的一个类。继承自:IEquatable<BitString>。
一种支持位运算、连接、子串提取以及在字节和十六进制之间相互转换的可变长度位串。
此类提供 35 个方法,用于在 .NET 程序中处理 BitString 对象。可用的方法包括:And、BitString、Concatenate、Empty、Equals、FromBitsString、FromBytesBuffer、FromHexString、Get64Bits、GetHashCode、Not、One,以及另外 11 个方法。安装 Aspose.PDF FOSS for .NET 包后,所有公共成员均可被任何 .NET 应用访问。属性:Length。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
Length | int | 读取 | 位数。 |
方法
| 签名 | 描述 |
|---|---|
BitString(length: int) | 创建一个给定长度的全零 BitString。 |
BitString(length: int, fill: bool) | 创建一个给定长度、填充为 0 或 1 的 BitString。 |
BitString(bytes: byte[]) | 从字节数组创建(字节顺序相反:最后一个字节 → 最左边的位)。 |
BitString(bytes: byte[], minBitLength: int, totalBitLength: int) | 从字节创建,先修剪至 minBitLength,然后左侧填充至 totalBitLength。 |
BitString(source: BitString) | 复制已有的 BitString 并在前面添加填充零位。 |
BitString(source: BitString, padding: int) | 复制已有的 BitString 并在前面添加填充零位。 |
Empty() | 对该 BitString 实例调用 Empty。 |
Zero() | 对该 BitString 实例调用 Zero。 |
One() | 对该 BitString 实例调用 One。 |
Zeroes(count: int) | 对该 BitString 实例调用 Zeroes(count)。 |
Ones(count: int) | 在此 BitString 实例上调用 Ones(count)。 |
FromBitsString(s: string) | 在此 BitString 实例上调用 FromBitsString(s)。 |
FromHexString(hex: string, bitLength: int?) | 从十六进制字符串(大端字节)解析,可选地修剪至 bitLength 的最低有效位。 |
FromBytesBuffer(buffer: byte[], offset: int, count: int) | 在此 BitString 实例上调用 FromBytesBuffer(buffer, offset, count)。 |
ToString() | 二进制字符串,由‘0’和‘1’组成(最左侧 = MSB = 位 (Length-1))。 |
ToHexByteString() | 十六进制字节串(字节顺序与构造函数相同:byte[0] 为 LSB → “0d19ff20”)。 |
ToBytes() | 转换为字节数组。 |
Equals(other: BitString?) | 在此 BitString 实例上调用 Equals(other)。 |
Equals(obj: object?) | 在此 BitString 实例上调用 Equals(obj)。 |
GetHashCode() | 在此 BitString 实例上调用 GetHashCode。 |
Xor(a: BitString, b: BitString) | 在此 BitString 实例上调用 Xor(a, b)。 |
Xor(other: BitString) | 在此 BitString 实例上调用 Xor(other)。 |
Or(a: BitString, b: BitString) | 在此 BitString 实例上调用 Or(a, b)。 |
Or(other: BitString) | 在此 BitString 实例上调用 Or(other)。 |
And(a: BitString, b: BitString) | 在此 BitString 实例上调用 And(a, b)。 |
And(other: BitString) | 在此 BitString 实例上调用 And(other)。 |
Not(a: BitString) | 在此 BitString 实例上调用 Not(a)。 |
Not() | |
Concatenate(a: BitString, b: BitString) | Static: result = b 位后跟 a 位(b 已预先添加)。 |
Concatenate(other: BitString) | In-place: 在此之前预先添加其他位。 |
Substring(startFromEnd: int) | 提取所有位,除去最后的 startFromEnd 位。 |
Substring(startFromEnd: int, count: int) | 提取 count 位,从位置 (Length - startFromEnd - count) 开始。 |
PadWithZeroes(count: int) | 在前面添加计数个零位。 |
Get64Bits(pos: int) | 从位位置 pos 开始读取 64 位(必须是 64 的倍数)。 |
Set64Bits(pos: int, value: ulong) | 从位位置 pos 开始写入 64 位(必须是 64 的倍数)。 |