WriteByte() public method

Write a byte to the stream.
public WriteByte ( byte value ) : void
value byte The byte to write to the stream.
return void
コード例 #1
0
ファイル: BZip2.cs プロジェクト: dptetc/CSOTools
 public static void Compress(Stream inStream, Stream outStream, int blockSize)
 {
     if (inStream == null)
     {
         throw new ArgumentNullException("inStream");
     }
     if (outStream == null)
     {
         throw new ArgumentNullException("outStream");
     }
     try
     {
         using (BZip2OutputStream bzip2OutputStream = new BZip2OutputStream(outStream, blockSize))
         {
             for (int num = inStream.ReadByte(); num != -1; num = inStream.ReadByte())
             {
                 bzip2OutputStream.WriteByte((byte)num);
             }
         }
     }
     finally
     {
         if (inStream != null)
         {
             ((IDisposable)inStream).Dispose();
         }
     }
 }
コード例 #2
0
ファイル: BZip2.cs プロジェクト: hw233/kbengine_sFrame
        /// <summary>
        /// Compress <paramref name="inStream">input stream</paramref> sending
        /// result to <paramref name="outStream">output stream</paramref>
        /// </summary>
        /// <param name="inStream">The stream to compress.</param>
        /// <param name="outStream">The stream to write compressed data to.</param>
        /// <param name="blockSize">The block size to use.</param>
        /// <remarks>Both streams are closed on completion</remarks>
        public static void Compress(Stream inStream, Stream outStream, int blockSize)
        {
            if (inStream == null)
            {
                throw new ArgumentNullException("inStream");
            }

            if (outStream == null)
            {
                throw new ArgumentNullException("outStream");
            }

            using (inStream)
            {
                using (BZip2OutputStream bzos = new BZip2OutputStream(outStream, blockSize))
                {
                    int ch = inStream.ReadByte();
                    while (ch != -1)
                    {
                        bzos.WriteByte((byte)ch);
                        ch = inStream.ReadByte();
                    }
                }
            }
        }
コード例 #3
0
		public static void Compress(Stream instream, Stream outstream, int blockSize) 
		{			
			System.IO.Stream bos = outstream;
			System.IO.Stream bis = instream;
			int ch = bis.ReadByte();
			BZip2OutputStream bzos = new BZip2OutputStream(bos, blockSize);
			while(ch != -1) {
				bzos.WriteByte((byte)ch);
				ch = bis.ReadByte();
			}
			bis.Close();
			bzos.Close();
		}
コード例 #4
0
ファイル: BZip2.cs プロジェクト: yuxi214/siteservercms
        /// <summary>
        /// Compress <paramref name="instream">input stream</paramref> sending
        /// result to <paramref name="outputstream">output stream</paramref>
        /// </summary>
        public static void Compress(Stream instream, Stream outstream, int blockSize)
        {
            var bos  = outstream;
            var bis  = instream;
            var ch   = bis.ReadByte();
            var bzos = new BZip2OutputStream(bos, blockSize);

            while (ch != -1)
            {
                bzos.WriteByte((byte)ch);
                ch = bis.ReadByte();
            }
            bis.Close();
            bzos.Close();
        }
コード例 #5
0
        public static void Compress(Stream instream, Stream outstream, int blockSize)
        {
            Stream            stream  = outstream;
            Stream            stream2 = instream;
            int               num     = stream2.ReadByte();
            BZip2OutputStream stream3 = new BZip2OutputStream(stream, blockSize);

            while (num != -1)
            {
                stream3.WriteByte((byte)num);
                num = stream2.ReadByte();
            }
            stream2.Close();
            stream3.Close();
        }
コード例 #6
0
ファイル: BZip2.cs プロジェクト: NoobSkie/taobao-shop-helper
		public static void Compress(Stream inStream, Stream outStream, int blockSize) 
		{			
			if ( inStream == null ) {
				throw new ArgumentNullException("inStream");
			}
			
			if ( outStream == null ) {
				throw new ArgumentNullException("outStream");
			}
			
			using ( inStream ) {
				using (BZip2OutputStream bzos = new BZip2OutputStream(outStream, blockSize)) {
					int ch = inStream.ReadByte();
					while (ch != -1) {
						bzos.WriteByte((byte)ch);
						ch = inStream.ReadByte();
					}
				}
			}
		}
コード例 #7
0
 public static void Compress(Stream inStream, Stream outStream, int blockSize)
 {
     if (inStream == null)
     {
         throw new ArgumentNullException("inStream");
     }
     if (outStream == null)
     {
         throw new ArgumentNullException("outStream");
     }
     using (inStream)
     {
         using (BZip2OutputStream stream = new BZip2OutputStream(outStream, blockSize))
         {
             for (int i = inStream.ReadByte(); i != -1; i = inStream.ReadByte())
             {
                 stream.WriteByte((byte)i);
             }
         }
     }
 }