C# 클래스 Zlib.GZipStream

A class for compressing and decompressing GZIP streams.
상속: Stream
파일 보기 프로젝트 열기: robertbaker/SevenUpdate

공개 메소드들

메소드 설명
Flush ( ) : void

Flush the stream.

GZipStream ( Stream stream, CompressionMode mode, CompressionLevel level = CompressionLevel.Default, bool leaveOpen = false ) : System

Create a GZipStream using the specified CompressionMode and the specified CompressionLevel, and explicitly specify whether the stream should be left open after Deflation or Inflation.

This constructor allows the application to request that the captive stream remain open after the deflation or inflation occurs. By default, afterClose() is called on the stream, the captive stream is also closed. In some cases this is not desired, for example if the stream is a memory stream that will be re-read after compressed data has been written to it. Specify true for the leaveOpen parameter to leave the stream open.

As noted in the class documentation, the CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. AGZipStream with CompressionMode.Compress works only throughWrite(). A GZipStream with CompressionMode.Decompress works only through Read().

GZipStream ( Stream stream, CompressionMode mode, bool leaveOpen ) : System

Create a GZipStream using the specified CompressionMode, and explicitly specify whether the stream should be left open after Deflation or Inflation.

This constructor allows the application to request that the captive stream remain open after the deflation or inflation occurs. By default, afterClose() is called on the stream, the captive stream is also closed. In some cases this is not desired, for example if the stream is a memory stream that will be re-read after compressed data has been written to it. Specify true for the leaveOpen parameter to leave the stream open.

The CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. A GZipStream withCompressionMode.Compress works only through Write(). A GZipStream with CompressionMode.Decompress works only through Read().

See the other overloads of this constructor for example code.

Read ( byte buffer, int offset, int count ) : int

Read and decompress data from the source stream.

With a GZipStream, decompression is done through reading.

Seek ( long offset, SeekOrigin origin ) : long

Calling this method always throws a NotImplementedException.

SetLength ( long value ) : void

Calling this method always throws a NotImplementedException.

Write ( byte buffer, int offset, int count ) : void

Write data to the stream.

If you wish to use the GZipStream to compress data while writing, you can create a GZipStream with CompressionMode.Compress, and a writable output stream. Then call Write() on that GZipStream, providing uncompressed data as input. The data sent to the output stream will be the compressed form of the data written.

A GZipStream can be used for Read() or Write(), but not both. Writing implies compression. Reading implies decompression.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Dispose the stream.

This may or may not result in a Close() call on the captive stream. See the doc on constructors that take a leaveOpen parameter for more information.

비공개 메소드들

메소드 설명
EmitHeader ( ) : int

메소드 상세

Dispose() 보호된 메소드

Dispose the stream.
This may or may not result in a Close() call on the captive stream. See the doc on constructors that take a leaveOpen parameter for more information.
protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

Flush() 공개 메소드

Flush the stream.
public Flush ( ) : void
리턴 void

GZipStream() 공개 메소드

Create a GZipStream using the specified CompressionMode and the specified CompressionLevel, and explicitly specify whether the stream should be left open after Deflation or Inflation.

This constructor allows the application to request that the captive stream remain open after the deflation or inflation occurs. By default, afterClose() is called on the stream, the captive stream is also closed. In some cases this is not desired, for example if the stream is a memory stream that will be re-read after compressed data has been written to it. Specify true for the leaveOpen parameter to leave the stream open.

As noted in the class documentation, the CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. AGZipStream with CompressionMode.Compress works only throughWrite(). A GZipStream with CompressionMode.Decompress works only through Read().

public GZipStream ( Stream stream, CompressionMode mode, CompressionLevel level = CompressionLevel.Default, bool leaveOpen = false ) : System
stream Stream The stream which will be read or written.
mode CompressionMode Indicates whether the GZipStream will compress or decompress.
level CompressionLevel A tuning knob to trade speed for effectiveness.
leaveOpen bool true if the application would like the stream to remain open after inflation/deflation.
리턴 System

GZipStream() 공개 메소드

Create a GZipStream using the specified CompressionMode, and explicitly specify whether the stream should be left open after Deflation or Inflation.

This constructor allows the application to request that the captive stream remain open after the deflation or inflation occurs. By default, afterClose() is called on the stream, the captive stream is also closed. In some cases this is not desired, for example if the stream is a memory stream that will be re-read after compressed data has been written to it. Specify true for the leaveOpen parameter to leave the stream open.

The CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. A GZipStream withCompressionMode.Compress works only through Write(). A GZipStream with CompressionMode.Decompress works only through Read().

See the other overloads of this constructor for example code.

public GZipStream ( Stream stream, CompressionMode mode, bool leaveOpen ) : System
stream Stream The stream which will be read or written. This is called the "captive" stream in other places in this documentation.
mode CompressionMode Indicates whether the GZipStream will compress or decompress.
leaveOpen bool true if the application would like the base stream to remain open after inflation/deflation.
리턴 System

Read() 공개 메소드

Read and decompress data from the source stream.
With a GZipStream, decompression is done through reading.
public Read ( byte buffer, int offset, int count ) : int
buffer byte The buffer into which the decompressed data should be placed.
offset int the offset within that data array to put the first byte read.
count int the number of bytes to read.
리턴 int

Seek() 공개 메소드

Calling this method always throws a NotImplementedException.
public Seek ( long offset, SeekOrigin origin ) : long
offset long This parameter is not used
origin SeekOrigin This parameter is not used
리턴 long

SetLength() 공개 메소드

Calling this method always throws a NotImplementedException.
public SetLength ( long value ) : void
value long This parameter is not used
리턴 void

Write() 공개 메소드

Write data to the stream.

If you wish to use the GZipStream to compress data while writing, you can create a GZipStream with CompressionMode.Compress, and a writable output stream. Then call Write() on that GZipStream, providing uncompressed data as input. The data sent to the output stream will be the compressed form of the data written.

A GZipStream can be used for Read() or Write(), but not both. Writing implies compression. Reading implies decompression.

public Write ( byte buffer, int offset, int count ) : void
buffer byte The buffer holding data to write to the stream.
offset int the offset within that data array to find the first byte to write.
count int the number of bytes to write.
리턴 void