当前位置: 首页>>代码示例>>C#>>正文


C# Stream.WriteByte方法代码示例

本文整理汇总了C#中System.IO.Stream.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# Stream.WriteByte方法的具体用法?C# Stream.WriteByte怎么用?C# Stream.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.Stream的用法示例。


在下文中一共展示了Stream.WriteByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteInt

 private static void WriteInt(Stream stream, int value)
 {
     stream.WriteByte((byte)(value));
     stream.WriteByte((byte)(value >> 8));
     stream.WriteByte((byte)(value >> 16));
     stream.WriteByte((byte)(value >> 24));
 }
开发者ID:dsmithson,项目名称:KnightwareCore,代码行数:7,代码来源:BitmapHelper.cs

示例2: Pack

        public static void Pack(Stream stream, UInt32 value)
        {
            if (value > ZMaxValue)
                throw new ArgumentOutOfRangeException("value", value, "Must be between 0 and " + ZMaxValue);

            byte length;
            if (value <= 0x3F) length = 0;
            else if (value <= 0x3FFF) length = 1;
            else if (value <= 0x3FFFFF) length = 2;
            else length = 3;

            var b = (byte)(value << 26 >> 24);
            b = (byte)(b | length);
            stream.WriteByte(b);

            if (length == 0) return;
            b = (byte)(value << 18 >> 24);
            stream.WriteByte(b);

            if (length == 1) return;
            b = (byte)(value << 10 >> 24);
            stream.WriteByte(b);

            if (length == 2) return;
            b = (byte)(value << 2 >> 24);
            stream.WriteByte(b);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:27,代码来源:BinaryZPacker.cs

示例3: WriteInt

 public static void WriteInt(Stream outStream,int n)
 {
     outStream.WriteByte((byte)(n >> 24));
     outStream.WriteByte((byte)(n >> 16));
     outStream.WriteByte((byte)(n >> 8));
     outStream.WriteByte((byte)n);
 }
开发者ID:hellogavin,项目名称:fontsubset,代码行数:7,代码来源:IOUtils.cs

示例4: UrlEncodeChar

        static void UrlEncodeChar (char c, Stream result, bool isUnicode) {
            if (c > ' ' && NotEncoded (c)) {
                result.WriteByte ((byte)c);
                return;
            }
            if (c==' ') {
                result.WriteByte ((byte)'+');
                return;
            }
            if (    (c < '0') ||
                (c < 'A' && c > '9') ||
                (c > 'Z' && c < 'a') ||
                (c > 'z')) {
                if (isUnicode && c > 127) {
                    result.WriteByte ((byte)'%');
                    result.WriteByte ((byte)'u');
                    result.WriteByte ((byte)'0');
                    result.WriteByte ((byte)'0');
                }
                else
                    result.WriteByte ((byte)'%');

                int idx = ((int) c) >> 4;
                result.WriteByte ((byte)hexChars [idx]);
                idx = ((int) c) & 0x0F;
                result.WriteByte ((byte)hexChars [idx]);
            }
            else {
                result.WriteByte ((byte)c);
            }
        }
开发者ID:Djohnnie,项目名称:Sonarr,代码行数:31,代码来源:UriHelper.cs

示例5: WriteUInt

 /// <summary>
 /// Write unsigned integer into the stream
 /// </summary>
 public static void WriteUInt(Stream destination, uint value)
 {
     destination.WriteByte((byte)value);
     destination.WriteByte((byte)(value >> 8));
     destination.WriteByte((byte)(value >> 16));
     destination.WriteByte((byte)(value >> 24));
 }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:TDSUtilities.cs

示例6: WriteValue

 public override void WriteValue(Stream stream, object value, SerializerSession session)
 {
     //null = 0
     // [0]
     //length < 255 gives length + 1 as a single byte + payload
     // [B length+1] [Payload]
     //others gives 254 + int32 length + payload
     // [B 254] [I Length] [Payload]
     if (value == null)
     {
         stream.WriteByte(0);
     }
     else
     {
         var bytes = Encoding.UTF8.GetBytes((string) value);
         if (bytes.Length < 255)
         {
             stream.WriteByte((byte)(bytes.Length+1));
             stream.Write(bytes, 0, bytes.Length);
         }
         else
         {
             stream.WriteByte(254);
             stream.WriteInt32(bytes.Length);
             stream.Write(bytes,0,bytes.Length);
         }
         
     }
 }
开发者ID:philiplaureano,项目名称:Wire,代码行数:29,代码来源:StringSerializer.cs

示例7: PackU

        public static void PackU(Stream stream, UInt32? nullableValue)
        {
            byte length;
            if (!nullableValue.HasValue) {
                stream.WriteByte(7);
                return;
            }
            var value = nullableValue.Value;
            if (value <= 0x1FU) length = 0;
            else if (value <= 0x1FFFU) length = 1;
            else if (value <= 0x1FFFFFU) length = 2;
            else if (value <= 0x1FFFFFFFU) length = 3;
            else length = 4;

            var b = (byte)(value << 27 >> 24);
            b = (byte)(b | length);
            stream.WriteByte(b);

            if (length == 0) return;
            b = (byte)(value << 19 >> 24);
            stream.WriteByte(b);

            if (length == 1) return;
            b = (byte)(value << 11 >> 24);
            stream.WriteByte(b);

            if (length == 2) return;
            b = (byte)(value << 3 >> 24);
            stream.WriteByte(b);

            if (length == 3) return;
            b = (byte)(value >> 29);
            stream.WriteByte(b);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:34,代码来源:BinaryV32Packer.cs

示例8: WriteInt

 public void WriteInt(uint val, Stream s)
 {
     s.WriteByte((byte)(0xff & val));
     s.WriteByte((byte)(0xff & (val >> 8)));
     s.WriteByte((byte)(0xff & (val >> 16)));
     s.WriteByte((byte)(0xff & (val >> 24)));
 }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:7,代码来源:BaseCmd.cs

示例9: Write

        public void Write(Stream fs, bool comFiles)
        {
            //beginning of the uninstall file info
            if (comFiles)
                fs.WriteByte(0x8B);
            else
                fs.WriteByte(0x8A);

            //path to the file
            WriteFiles.WriteDeprecatedString(fs, 0x01, Path);

            //delete the file?
            if (DeleteFile)
                WriteFiles.WriteBool(fs, 0x02, true);

            if (UnNGENFile)
            {
                WriteFiles.WriteBool(fs, 0x03, true);

                // the CPU version of the file to un-ngen
                WriteFiles.WriteInt(fs, 0x04, (int) CPUVersion);

                WriteFiles.WriteInt(fs, 0x05, (int)FrameworkVersion);
            }

            if (RegisterCOMDll != COMRegistration.None)
                WriteFiles.WriteInt(fs, 0x06, (int) RegisterCOMDll);

            //end of uninstall file info
            fs.WriteByte(0x9A);
        }
开发者ID:shunpei-suzuki,项目名称:wyupdate,代码行数:31,代码来源:RollbackUpdate.cs

示例10: WriteBgra

 public static void WriteBgra(Stream output, Color color)
 {
     output.WriteByte(color.B);
     output.WriteByte(color.G);
     output.WriteByte(color.R);
     output.WriteByte(color.A);
 }
开发者ID:kidaa,项目名称:Pulse,代码行数:7,代码来源:ColorsHelper.cs

示例11: Encode

 public void Encode(Stream stream)
 {
     stream.WriteByte((byte) initialCodeSize);
     curPixel = 0;
     Compress(initialCodeSize + 1, stream);
     stream.WriteByte(GifConstants.terminator);
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:7,代码来源:LzwEncoder.cs

示例12: WriteBeUint32

 public static void WriteBeUint32(Stream stm, uint u)
 {
     stm.WriteByte((byte)(u >> 24));
     stm.WriteByte((byte)(u >> 16));
     stm.WriteByte((byte)(u >> 8));
     stm.WriteByte((byte)(u));
 }
开发者ID:killbug2004,项目名称:reko,代码行数:7,代码来源:ResourceForkTests.cs

示例13: WriteUInt

 public static void WriteUInt(Stream stream, uint value)
 {
     stream.WriteByte((byte) (value & 0xff));
     stream.WriteByte((byte) ((value >> 8) & 0xff));
     stream.WriteByte((byte) ((value >> 0x10) & 0xff));
     stream.WriteByte((byte) ((value >> 0x18) & 0xff));
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:7,代码来源:StreamExtensions.cs

示例14: WriteLength

		private static void WriteLength(
            Stream	outStr,
            int		length)
        {
            if (length > 127)
            {
                int size = 1;
                int val = length;

				while ((val >>= 8) != 0)
                {
                    size++;
                }

				outStr.WriteByte((byte)(size | 0x80));

				for (int i = (size - 1) * 8; i >= 0; i -= 8)
                {
                    outStr.WriteByte((byte)(length >> i));
                }
            }
            else
            {
                outStr.WriteByte((byte)length);
            }
        }
开发者ID:ubberkid,项目名称:PeerATT,代码行数:26,代码来源:DERGenerator.cs

示例15: OutputInt

 public static void OutputInt(int n, Stream s)
 {
     s.WriteByte((byte)(n >> 24));
     s.WriteByte((byte)(n >> 16));
     s.WriteByte((byte)(n >> 8));
     s.WriteByte((byte)n);
 }
开发者ID:jomamorales,项目名称:createPDF,代码行数:7,代码来源:PngWriter.cs


注:本文中的System.IO.Stream.WriteByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。