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
        /// <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
        /// <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
		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);
             }
         }
     }
 }