class Buffer : public object
二进制数据缓存对象,用于 io 读写的数据处理
Buffer 对象为全局基础类,在任何时候都可以直接以 new Buffer(…) 创建:
var buf = new Buffer();
| Method and Description |
|---|
Buffer(Array datas)缓存对象构造函数 |
Buffer(ArrayBuffer datas)缓存对象构造函数 |
Buffer(TypedArray datas)缓存对象构造函数 |
Buffer(Buffer buffer)缓存对象构造函数 |
Buffer(String str,String codec)缓存对象构造函数 |
Buffer(Integer size)缓存对象构造函数 |
| Type | Method and Description |
|---|---|
| Integer | public Integer operator[]operator[]operator[]缓存对象可使用下标直接访问二进制数据 |
| readonly Integer | public readonly Integer lengthlengthlength获取缓存对象的尺寸 |
| Type | Method and Description |
|---|---|
| void | resize(Integer sz)修改缓存对象尺寸 |
| void | append(Array datas)在缓存对象尾部写入一组数据 |
| void | append(TypedArray datas)在缓存对象尾部写入一组数据 |
| void | append(ArrayBuffer datas)在缓存对象尾部写入一组数据 |
| void | append(Buffer data)在缓存对象尾部写入一组二进制数据 |
| void | append(String str,String codec)在缓存对象尾部写入字符串,字符串将以 utf-8 格式写入 |
| Integer | write(String str,Integer offset,Integer length,String codec)向缓存对象写入指定字符串,字符串默认为utf-8,越界时只写入部分数据 |
| Integer | write(String str,Integer offset,String codec)向缓存对象写入指定字符串,字符串默认为utf-8,越界时只写入部分数据 |
| Integer | write(String str,String codec)向缓存对象写入指定字符串,字符串默认为utf-8,越界时只写入部分数据 |
| Buffer | fill(Integer v,Integer offset,Integer end)为Buffer对象填充指定内容数据 |
| Buffer | fill(Buffer v,Integer offset,Integer end)为Buffer对象填充指定内容数据 |
| Buffer | fill(String v,Integer offset,Integer end)为Buffer对象填充指定内容数据 |
| Integer | indexOf(Integer v,Integer offset)返回某个指定数据在Buffer中首次出现的位置 |
| Integer | indexOf(Buffer v,Integer offset)返回某个指定数据在Buffer中首次出现的位置 |
| Integer | indexOf(String v,Integer offset)返回某个指定数据在Buffer中首次出现的位置 |
| Integer | compare(Buffer buf)比较缓存区的内容 |
| Integer | copy(Buffer targetBuffer,Integer targetStart,Integer sourceStart,Integer sourceEnd)从源缓存对象区域拷贝数据到目标缓存对象区域 |
| Integer | readUInt8(Integer offset,Boolean noAssert)从缓存对象读取一个 8 位无符号整型数值 |
| Integer | readUInt16LE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位无符号整型数值,以低字节序的存储方式 |
| Integer | readUInt16BE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位无符号整型数值,以高字节序的存储方式 |
| Long | readUInt32LE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位无符号整型数值,以低字节序的存储方式 |
| Long | readUInt32BE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位无符号整型数值,以高字节序的存储方式 |
| Long | readUIntLE(Integer offset,Boolean noAssert)从缓存对象读取一个无符号整型数值,最大支持 48 位,以低字节序的存储方式 |
| Long | readUIntBE(Integer offset,Boolean noAssert)从缓存对象读取一个无符号整型数值,最大支持 48 位,以高字节序的存储方式 |
| Integer | readInt8(Integer offset,Boolean noAssert)从缓存对象读取一个 8 位整型数值 |
| Integer | readInt16LE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位整型数值,以低字节序的存储方式 |
| Integer | readInt16BE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位整型数值,以高字节序的存储方式 |
| Integer | readInt32LE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位整型数值,以低字节序的存储方式 |
| Integer | readInt32BE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位整型数值,以高字节序的存储方式 |
| Long | readIntLE(Integer offset,Boolean noAssert)从缓存对象读取一个整型数值,最大支持 48 位,以低字节序的存储方式 |
| Long | readIntBE(Integer offset,Boolean noAssert)从缓存对象读取一个整型数值,最大支持 48 位,以高字节序的存储方式 |
| Int64 | readInt64LE(Integer offset,Boolean noAssert)从缓存对象读取一个 64 位整型数值,以低字节序的存储方式 |
| Int64 | readInt64BE(Integer offset,Boolean noAssert)从缓存对象读取一个 64 位整型数值,以高字节序的存储方式 |
| Number | readFloatLE(Integer offset,Boolean noAssert)从缓存对象读取一个浮点数,以低字节序的存储方式 |
| Number | readFloatBE(Integer offset,Boolean noAssert)从缓存对象读取一个浮点数,以高字节序的存储方式 |
| Number | readDoubleLE(Integer offset,Boolean noAssert)从缓存对象读取一个双精度浮点数,以低字节序的存储方式 |
| Number | readDoubleBE(Integer offset,Boolean noAssert)从缓存对象读取一个双精度浮点数,以高字节序的存储方式 |
| void | writeUInt8(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 8 位无符号整型数值 |
| void | writeUInt16LE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位无符号整型数值,以低字节序的存储方式 |
| void | writeUInt16BE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位无符号整型数值,以高字节序的存储方式 |
| void | writeUInt32LE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位无符号整型数值,以低字节序的存储方式 |
| void | writeUInt32BE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位无符号整型数值,以高字节序的存储方式 |
| void | writeUIntLE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个无符号整型数值,最大支持 48 位,以低字节序的存储方式 |
| void | writeUIntBE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个无符号整型数值,最大支持 48 位,以高字节序的存储方式 |
| void | writeInt8(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 8 位整型数值 |
| void | writeInt16LE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位整型数值,以低字节序的存储方式 |
| void | writeInt16BE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位整型数值,以高字节序的存储方式 |
| void | writeInt32LE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位整型数值,以低字节序的存储方式 |
| void | writeInt32BE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位整型数值,以高字节序的存储方式 |
| void | writeIntLE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个整型数值,最大支持 48 位,以低字节序的存储方式 |
| void | writeIntBE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个整型数值,最大支持 48 位,以高字节序的存储方式 |
| void | writeInt64LE(Int64 value,Integer offset,Boolean noAssert)向缓存对象写入一个 64 位整型数值,以低字节序的存储方式 |
| void | writeInt64BE(Int64 value,Integer offset,Boolean noAssert)向缓存对象写入一个 64 位整型数值,以高字节序的存储方式 |
| void | writeFloatLE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个浮点数,以低字节序的存储方式 |
| void | writeFloatBE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个浮点数,以高字节序的存储方式 |
| void | writeDoubleLE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个双精度浮点数,以低字节序的存储方式 |
| void | writeDoubleBE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个双精度浮点数,以高字节序的存储方式 |
| Buffer | slice(Integer start)返回一个新缓存对象,包含指定起始到缓存结尾的数据 |
| Buffer | slice(Integer start,Integer end)返回一个新缓存对象,包含指定范围的数据,若范围超出缓存,则只返回有效部分数据 |
| String | hex()使用 16 进制编码缓存对象内容 |
| String | base64()使用 base64 编码缓存对象内容 |
| Array | toArray()返回全部二进制数据的数组 |
| String | toString(String codec,Integer offset,Integer end)返回二进制数据的编码字符串 |
| String | toString()返回二进制数据的 utf8 编码字符串 |
| void | dispose()强制回收对象,调用此方法后,对象资源将立即释放 |
| Boolean | equals(object expected)比较当前对象与给定的对象是否相等 |
| Value | toJSON(String key)返回对象的 JSON 格式表示,一般返回对象定义的可读属性集合 |
| Value | valueOf()返回对象本身的数值 |
| Boolean | isBuffer(Value v)检测给定的变量是否是 Buffer 对象 |
| Buffer | concat(Array buflist,Integer cutLength)拼接多个缓存区中的数据 |
Buffer(Array datas)缓存对象构造函数
datas 初始化数据数组Buffer(ArrayBuffer datas)缓存对象构造函数
datas 初始化数据数组Buffer(TypedArray datas)缓存对象构造函数
datas 初始化数据数组Buffer(Buffer buffer)缓存对象构造函数
buffer 初始化Buffer对象Buffer(String str,String codec)缓存对象构造函数
str 初始化字符串,字符串将以 utf-8 格式写入,缺省则创建一个空对象
codec 指定编码格式,允许值为:”hex”, “base64”, “utf8”, 或者系统支持的字符集
Buffer(Integer size)缓存对象构造函数
size 初始化缓冲区大小public Integer operator[]operator[]operator[]缓存对象可使用下标直接访问二进制数据
public readonly Integer lengthlengthlength获取缓存对象的尺寸
resize(Integer sz)修改缓存对象尺寸
sz 指定新尺寸append(Array datas)在缓存对象尾部写入一组数据
datas 初始化数据数组append(TypedArray datas)在缓存对象尾部写入一组数据
datas 初始化数据数组append(ArrayBuffer datas)在缓存对象尾部写入一组数据
datas 初始化数据数组append(Buffer data)在缓存对象尾部写入一组二进制数据
data 初始化二进制数据append(String str,String codec)在缓存对象尾部写入字符串,字符串将以 utf-8 格式写入
str 要写入的字符串
codec 指定编码格式,允许值为:”hex”, “base64”, “utf8”, 或者系统支持的字符集
write(String str,Integer offset,Integer length,String codec)向缓存对象写入指定字符串,字符串默认为utf-8,越界时只写入部分数据
str 待写入的字符串
offset 写入起始位置
length 写入长度(单位字节,默认值-1),未指定时为待写入字符串的长度
codec 指定编码格式,允许值为:”hex”, “base64”, “utf8”, 或者系统支持的字符集
写入的数据字节长度
write(String str,Integer offset,String codec)向缓存对象写入指定字符串,字符串默认为utf-8,越界时只写入部分数据
str 待写入的字符串
offset 写入起始位置
codec 指定编码格式,允许值为:”hex”, “base64”, “utf8”, 或者系统支持的字符集
写入的数据字节长度
write(String str,String codec)向缓存对象写入指定字符串,字符串默认为utf-8,越界时只写入部分数据
str 待写入的字符串
codec 指定编码格式,允许值为:”hex”, “base64”, “utf8”, 或者系统支持的字符集
写入的数据字节长度
fill(Integer v,Integer offset,Integer end)为Buffer对象填充指定内容数据
v 需要填充的数据,如果未指定offset和end,将填充满整个buffer
offset 填充起始位置
end 填充终止位置
返回当前 Buffer 对象
fill(Buffer v,Integer offset,Integer end)为Buffer对象填充指定内容数据
v 需要填充的数据,如果未指定offset和end,将填充满整个buffer
offset 填充起始位置
end 填充终止位置
返回当前 Buffer 对象
fill(String v,Integer offset,Integer end)为Buffer对象填充指定内容数据
v 需要填充的数据,如果未指定offset和end,将填充满整个buffer
offset 填充起始位置
end 填充终止位置
返回当前 Buffer 对象
indexOf(Integer v,Integer offset)返回某个指定数据在Buffer中首次出现的位置
v 待查找数据,如果未指定offset,默认从起始位开始
offset 起始查找位置
indexOf(Buffer v,Integer offset)返回某个指定数据在Buffer中首次出现的位置
v 待查找数据,如果未指定offset,默认从起始位开始
offset 起始查找位置
indexOf(String v,Integer offset)返回某个指定数据在Buffer中首次出现的位置
v 待查找数据,如果未指定offset,默认从起始位开始
offset 起始查找位置
compare(Buffer buf)比较缓存区的内容
buf 待比较缓存对象内容比较结果
copy(Buffer targetBuffer,Integer targetStart,Integer sourceStart,Integer sourceEnd)从源缓存对象区域拷贝数据到目标缓存对象区域
targetBuffer 目标缓存对象
targetStart 目标缓存对象开始拷贝字节位置,缺省为 0
sourceStart 源缓存对象开始字节位置, 缺省为 0
sourceEnd 源缓存对象结束字节位置, 缺省为 -1,表示源数据长度
拷贝的数据字节长度
readUInt8(Integer offset,Boolean noAssert)从缓存对象读取一个 8 位无符号整型数值
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readUInt16LE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位无符号整型数值,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readUInt16BE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位无符号整型数值,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readUInt32LE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位无符号整型数值,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readUInt32BE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位无符号整型数值,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readUIntLE(Integer offset,Boolean noAssert)从缓存对象读取一个无符号整型数值,最大支持 48 位,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readUIntBE(Integer offset,Boolean noAssert)从缓存对象读取一个无符号整型数值,最大支持 48 位,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readInt8(Integer offset,Boolean noAssert)从缓存对象读取一个 8 位整型数值
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readInt16LE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位整型数值,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readInt16BE(Integer offset,Boolean noAssert)从缓存对象读取一个 16 位整型数值,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readInt32LE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位整型数值,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readInt32BE(Integer offset,Boolean noAssert)从缓存对象读取一个 32 位整型数值,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readIntLE(Integer offset,Boolean noAssert)从缓存对象读取一个整型数值,最大支持 48 位,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readIntBE(Integer offset,Boolean noAssert)从缓存对象读取一个整型数值,最大支持 48 位,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readInt64LE(Integer offset,Boolean noAssert)从缓存对象读取一个 64 位整型数值,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readInt64BE(Integer offset,Boolean noAssert)从缓存对象读取一个 64 位整型数值,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的整型数值
readFloatLE(Integer offset,Boolean noAssert)从缓存对象读取一个浮点数,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的浮点数
readFloatBE(Integer offset,Boolean noAssert)从缓存对象读取一个浮点数,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的浮点数
readDoubleLE(Integer offset,Boolean noAssert)从缓存对象读取一个双精度浮点数,以低字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的双精度浮点数
readDoubleBE(Integer offset,Boolean noAssert)从缓存对象读取一个双精度浮点数,以高字节序的存储方式
offset 指定读取的起始位置,缺省为 0
noAssert 指定读取越界时不抛出错误,缺省为 flase,抛出
返回读取的双精度浮点数
writeUInt8(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 8 位无符号整型数值
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeUInt16LE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位无符号整型数值,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeUInt16BE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位无符号整型数值,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeUInt32LE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位无符号整型数值,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeUInt32BE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位无符号整型数值,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeUIntLE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个无符号整型数值,最大支持 48 位,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeUIntBE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个无符号整型数值,最大支持 48 位,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeInt8(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 8 位整型数值
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeInt16LE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位整型数值,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeInt16BE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 16 位整型数值,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeInt32LE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位整型数值,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeInt32BE(Integer value,Integer offset,Boolean noAssert)向缓存对象写入一个 32 位整型数值,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeIntLE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个整型数值,最大支持 48 位,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeIntBE(Long value,Integer offset,Boolean noAssert)向缓存对象写入一个整型数值,最大支持 48 位,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeInt64LE(Int64 value,Integer offset,Boolean noAssert)向缓存对象写入一个 64 位整型数值,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeInt64BE(Int64 value,Integer offset,Boolean noAssert)向缓存对象写入一个 64 位整型数值,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeFloatLE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个浮点数,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeFloatBE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个浮点数,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeDoubleLE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个双精度浮点数,以低字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
writeDoubleBE(Number value,Integer offset,Boolean noAssert)向缓存对象写入一个双精度浮点数,以高字节序的存储方式
value 指定写入的数值
offset 指定写入的起始位置
noAssert 指定写入越界时不抛出错误,缺省为 flase,抛出
slice(Integer start)返回一个新缓存对象,包含指定起始到缓存结尾的数据
start 指定范围的起始,缺省从头开始返回新的缓存对象
slice(Integer start,Integer end)返回一个新缓存对象,包含指定范围的数据,若范围超出缓存,则只返回有效部分数据
start 指定范围的起始
end 指定范围的结束
返回新的缓存对象
hex()使用 16 进制编码缓存对象内容
返回编码字符串
base64()使用 base64 编码缓存对象内容
返回编码字符串
toArray()返回全部二进制数据的数组
返回包含对象数据的数组
toString(String codec,Integer offset,Integer end)返回二进制数据的编码字符串
codec 指定编码格式,允许值为:”hex”, “base64”, “utf8”, 或者系统支持的字符集
offset 读取起始位置
end 读取终止位置
返回对象的字符串表示
toString()返回二进制数据的 utf8 编码字符串
返回对象的字符串表示
dispose()强制回收对象,调用此方法后,对象资源将立即释放
equals(object expected)比较当前对象与给定的对象是否相等
expected 制定比较的目标对象返回对象比较的结果
toJSON(String key)返回对象的 JSON 格式表示,一般返回对象定义的可读属性集合
key 未使用返回包含可 JSON 序列化的值
valueOf()返回对象本身的数值
返回对象本身的数值
isBuffer(Value v)检测给定的变量是否是 Buffer 对象
v 给定需要检测的变量传入对象是否 Buffer 对象
concat(Array buflist,Integer cutLength)拼接多个缓存区中的数据
buflist 待拼接的Buffer数组
cutLength 截取多少个Buffer对象
拼接后产生的新 Buffer 对象