ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.WriteByte C# (CSharp) Method

WriteByte() public method

Writes a single byte to the compressed output stream.
public WriteByte ( byte value ) : void
value byte /// The byte value. ///
return void
        public override void WriteByte(byte value)
        {
            byte[] b = new byte[1];
            b[0] = value;
            Write(b, 0, 1);
        }

Usage Example

Example #1
0
		protected MemoryStream CompressBuffer(byte[] buf, int index, int length)
		{

			if (length < MIN_COMPRESS_LENGTH) return null;

			MemoryStream ms = new MemoryStream(buf.Length);
			DeflaterOutputStream dos = new DeflaterOutputStream(ms);

			dos.WriteByte( (byte)(length & 0xff ));
			dos.WriteByte( (byte)((length >> 8) & 0xff ));
			dos.WriteByte( (byte)((length >> 16) & 0xff ));
			dos.WriteByte( 0 );

			dos.Write( buf, index, length );
			dos.Finish();
			if (ms.Length > length+4) return null;
			return ms;
		}
All Usage Examples Of ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream::WriteByte