示例#1
0
        /// <summary> serialize a numeric value, only using as many bytes as needed. splits up the value into
        /// chunks of 7 bits, using as many chunks as needed to unambiguously represent the value. each
        /// chunk is serialized as a single byte, where the most-significant bit is set to 1 to indicate
        /// there are more bytes to follow, or 0 to indicate the last byte
        ///
        /// </summary>
        //UPGRADE_TODO: Class 'java.io.DataOutputStream' was converted to 'System.IO.BinaryWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataOutputStream'"
        public override void  writeExternal(System.IO.BinaryWriter out_Renamed)
        {
            int n = ExtUtil.toInt((long)((System.Int64)val));

            if (n >= -bias && n < 255 - bias)
            {
                n += bias;
                out_Renamed.Write((byte)(n >= 128?n - 256:n));
            }
            else
            {
                out_Renamed.Write((System.Byte) 0xff);
                out_Renamed.Write(n);
            }
        }