Exemple #1
0
        public void Copy(IDataInputView source, IDataOutputView target)
        {
            var len = source.ReadUnsignedByte();

            target.WriteByte(len);

            if (len >= HighBit)
            {
                var shift = 7;
                int curr;
                len = len & 0x7f;
                while ((curr = source.ReadUnsignedByte()) >= HighBit)
                {
                    len   |= (curr & 0x7f) << shift;
                    shift += 7;
                    target.WriteByte(curr);
                }
                len |= curr << shift;
                target.WriteByte(curr);
            }

            for (var i = 0; i < len; i++)
            {
                var c = source.ReadUnsignedByte();
                target.WriteByte(c);
                while (c >= HighBit)
                {
                    c = source.ReadUnsignedByte();
                    target.WriteByte(c);
                }
            }
        }