System.IO.Compression.DeflateStream.ReadByte C# (CSharp) Method

ReadByte() public method

public ReadByte ( ) : int
return int
        public override int ReadByte()
        {
            EnsureDecompressionMode();
            EnsureNotDisposed();

            // Try to read a single byte from zlib without allocating an array, pinning an array, etc.
            // If zlib doesn't have any data, fall back to the base stream implementation, which will do that.
            byte b;
            return _inflater.Inflate(out b) ? b : base.ReadByte();
        }

Usage Example

Example #1
0
        /// <summary>
        /// Build and return a revision by applying a set of DiffCodes to a base version.
        /// DiffCodes should be from StorageDiffCode().
        /// </summary>
        public static List<Fragment> BuildChanges(string BaseRevision, byte[] DiffCodes)
        {
            // Decompress and send to real decoder.
            var @in = new MemoryStream(DiffCodes); // this will receive the compressed code
            var filter = new DeflateStream(@in, CompressionMode.Decompress);

            var @out = new List<byte>(DiffCodes.Length);
            int b = filter.ReadByte();
            while (b >= 0) {
                @out.Add((byte)b);
                b = filter.ReadByte();
            }
            return DecodeRevisionFragments(BaseRevision, Encoding.UTF8.GetString(@out.ToArray()));
        }
All Usage Examples Of System.IO.Compression.DeflateStream::ReadByte