public WriteByte ( byte value ) : void | ||
value | byte | The byte to write to the stream. |
Результат | void |
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(); } } }
/// <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(); } } } }
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(); }
/// <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(); }
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(); }
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(); } } } }
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); } } } }