skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class CompressedStream

Stream wrapper that compresses or decompresses data on the fly over a base stream, optionally applying checksum and encryption.

Inheritance
System.Object
System.MarshalByRefObject
System.IO.Stream
OperationStream
CompressedStream
Inherited Members
OperationStream.Flush()
OperationStream.Read(Byte[], Int32, Int32, CancellationToken)
OperationStream.Seek(Int64, SeekOrigin)
OperationStream.EnsureNotDisposed()
OperationStream.CanRead
OperationStream.CanSeek
OperationStream.CanWrite
OperationStream.HasFlushedFinalBlock
OperationStream.Length
OperationStream.Position
OperationStream.TotalPlainCount
OperationStream.TotalTransformedCount
System.IO.Stream.Null
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.Close()
System.IO.Stream.Dispose()
System.IO.Stream.FlushAsync()
System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.ReadByte()
System.IO.Stream.WriteByte(System.Byte)
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.CreateObjRef(System.Type)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Zip
Assembly: Telerik.Windows.Zip.dll

Syntax

public class CompressedStream : OperationStream, IDisposable

Constructors

CompressedStream(Stream, StreamOperationMode, CompressionSettings)

Creates a compression or decompression stream using the specified settings.

Declaration
public CompressedStream(Stream baseStream, StreamOperationMode mode, CompressionSettings settings)
Parameters
System.IO.Stream baseStream

The base input/output stream.

StreamOperationMode mode

Stream operational mode.

CompressionSettings settings

Compression settings.

Exceptions
System.ArgumentOutOfRangeException

Specified mode is not allowed for the given stream.

CompressedStream(Stream, StreamOperationMode, CompressionSettings, Boolean, EncryptionSettingsBase)

Creates a compression or decompression stream with explicit checksum and encryption options.

Declaration
public CompressedStream(Stream baseStream, StreamOperationMode mode, CompressionSettings settings, bool useCrc32, EncryptionSettingsBase encryptionSettings)
Parameters
System.IO.Stream baseStream

The base input/output stream.

StreamOperationMode mode

Stream operational mode.

CompressionSettings settings

Compression settings.

System.Boolean useCrc32

Indicates whether the CRC32 (true) or Adler32 (false) checksum algorithm will be used.

EncryptionSettingsBase encryptionSettings

Encryption settings.

Exceptions
System.ArgumentOutOfRangeException

Specified mode is not allowed for the given stream.

Properties

Checksum

Gets the running checksum (CRC32 or Adler32) accumulated from the first read/write until Flush.

Declaration
public long Checksum { get; }
Property Value
System.Int64

CompressedSize

Gets the total compressed byte count including any encryption header bytes.

Declaration
public long CompressedSize { get; }
Property Value
System.Int64

Methods

Dispose(Boolean)

Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

Declaration
protected override void Dispose(bool disposing)
Parameters
System.Boolean disposing

Value which indicates whether both managed and unmanaged resources (true) on only unmanaged resources (false) should be released.

Overrides
OperationStream.Dispose(Boolean)

Read(Byte[], Int32, Int32)

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
System.Byte[] buffer

An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing the data read from the current stream.

System.Int32 count

The maximum number of bytes to be read from the current stream.

Returns
System.Int32

The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

Overrides
OperationStream.Read(Byte[], Int32, Int32)
Exceptions
System.NotSupportedException

The StreamOperationMode associated with current OperationStream object does not match the underlying stream.
For example, this exception is thrown when using Read with an underlying stream that is write only.

System.ArgumentOutOfRangeException

The offset parameter is less than zero.-or- The count parameter is less than zero.

System.ArgumentException

The sum of the count and offset parameters is larger than the length of the buffer.

ReadAsync(Byte[], Int32, Int32, CancellationToken)

Reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

Declaration
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
System.Byte[] buffer

An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing the data read from the current stream.

System.Int32 count

The maximum number of bytes to be read from the current stream.

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
System.Threading.Tasks.Task<System.Int32>

A task returning the total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

Overrides
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)

SetLength(Int64)

Sets the length of the current stream.

Declaration
public override void SetLength(long value)
Parameters
System.Int64 value

The desired length of the current stream in bytes.

Overrides
OperationStream.SetLength(Int64)

Write(Byte[], Int32, Int32)

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
System.Byte[] buffer

An array of bytes. This method copies count bytes from buffer to the current stream.

System.Int32 offset

The zero-based byte offset in buffer at which to begin copying bytes to the current stream.

System.Int32 count

The number of bytes to be written to the current stream.

Overrides
OperationStream.Write(Byte[], Int32, Int32)

Events

ChecksumReady

Raised when checksum calculation completes for the processed data segment.

Declaration
public event EventHandler ChecksumReady
Event Type
System.EventHandler

Extension Methods

StreamExtensions.ReadExactly(Stream, Byte[], Int32, Int32)
StreamExtensions.CopyTo(Stream, Stream, Nullable<TimeSpan>)
StreamExtensions.CopyToAsync(Stream, Stream, CancellationToken)
Getting Started
  • Getting Started
Support Resources
  • Documentation
Community
  • Forums
  • Blogs
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.