//compress /// <summary> /// 压缩 /// </summary> public void compress() { byte[] b = BytesUtils.compressByteArr(_buf, 0, _length); _buf = b; _position = 0; _length = b.Length; }
//uncompress /// <summary> /// 解压缩(0->length)无视position /// </summary> public void unCompress() { byte[] b = BytesUtils.uncompressByteArr(_buf, _off, _length); _buf = b; _off = 0; _position = 0; _length = b.Length; }
/** 扩容 */ private void grow(int len) { int cap = BytesUtils.getCapacitySize(len); if (cap > _buf.Length) { byte[] bs = new byte[cap]; Buffer.BlockCopy(_buf, 0, bs, 0, _buf.Length); _buf = bs; } }
public override string ToString() { return(BytesUtils.bytesToString(_buf, _off, _length)); }
//check /// <summary> /// 获取某一段的字节hash(short) /// </summary> public short getHashCheck(int pos, int length) { return(BytesUtils.getHashCheck(_buf, pos + _off, length)); }