Fingerprint_Card
Loading...
Searching...
No Matches
ICSharpCode.SharpZipLib.GZip.GZipOutputStream Class Reference

This filter stream is used to compress a stream into a "GZIP" stream. The "GZIP" format is described in RFC 1952. More...

Inheritance diagram for ICSharpCode.SharpZipLib.GZip.GZipOutputStream:
Collaboration diagram for ICSharpCode.SharpZipLib.GZip.GZipOutputStream:

Public Member Functions

 GZipOutputStream (Stream baseOutputStream)
 Creates a GzipOutputStream with the default buffer size.
 GZipOutputStream (Stream baseOutputStream, int size)
 Creates a GZipOutputStream with the specified buffer size.
void SetLevel (int level)
 Sets the active compression level (1-9). The new level will be activated immediately.
int GetLevel ()
 Get the current compression level.
override void Write (byte[] buffer, int offset, int count)
 Write given buffer to output updating crc.
override void Close ()
 Writes remaining compressed output data to the output stream and closes it.
override void Finish ()
 Finish compression and write any footer information required to stream.
Public Member Functions inherited from ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream
 DeflaterOutputStream (Stream baseOutputStream)
 Creates a new DeflaterOutputStream with a default Deflater and default buffer size.
 DeflaterOutputStream (Stream baseOutputStream, Deflater deflater)
 Creates a new DeflaterOutputStream with the given Deflater and default buffer size.
 DeflaterOutputStream (Stream baseOutputStream, Deflater deflater, int bufferSize)
 Creates a new DeflaterOutputStream with the given Deflater and buffer size.
override long Seek (long offset, SeekOrigin origin)
 Sets the current position of this stream to the given value. Not supported by this class!
override void SetLength (long value)
 Sets the length of this stream to the given value. Not supported by this class!
override int ReadByte ()
 Read a byte from stream advancing position by one.
override int Read (byte[] buffer, int offset, int count)
 Read a block of bytes from stream.
override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 Asynchronous reads are not supported a NotSupportedException is always thrown.
override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 Asynchronous writes arent supported, a NotSupportedException is always thrown.
override void Flush ()
 Flushes the stream by calling Flush on the deflater and then on the underlying stream. This ensures that all bytes are flushed.
override void Close ()
 Calls Finish and closes the underlying stream when IsStreamOwner is true.
override void WriteByte (byte value)
 Writes a single byte to the compressed output stream.
override void Write (byte[] buffer, int offset, int count)
 Writes bytes from an array to the compressed stream.

Protected Attributes

Crc32 crc = new Crc32()
 CRC-32 value for uncompressed data.
Protected Attributes inherited from ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream
byte[] AESAuthCode
 Returns the 10 byte AUTH CODE to be appended immediately following the AES data stream.
Deflater deflater_
 The deflater which is used to deflate the stream.
Stream baseOutputStream_
 Base stream the deflater depends on.

Private Types

enum  OutputState { Header , Footer , Finished , Closed }

Private Member Functions

void WriteHeader ()

Private Attributes

OutputState state_ = OutputState.Header

Additional Inherited Members

Protected Member Functions inherited from ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream
void EncryptBlock (byte[] buffer, int offset, int length)
 Encrypt a block of data.
void InitializePassword (string password)
 Initializes encryption keys based on given password .
void InitializeAESPassword (ZipEntry entry, string rawPassword, out byte[] salt, out byte[] pwdVerifier)
 Initializes encryption keys based on given password.
void Deflate ()
 Deflates everything in the input buffers. This will call.
Properties inherited from ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream
bool IsStreamOwner [get, set]
 Get/set flag indicating ownership of the underlying stream. When the flag is true Close will close the underlying stream also.
bool CanPatchEntries [get]
 Allows client to determine if an entry can be patched after its added.
string Password [get, set]
 Get/set the password used for encryption.
override bool CanRead [get]
 Gets value indicating stream can be read from.
override bool CanSeek [get]
 Gets a value indicating if seeking is supported for this stream This property always returns false.
override bool CanWrite [get]
 Get value indicating if this stream supports writing.
override long Length [get]
 Get current length of stream.
override long Position [get, set]
 Gets the current position within the stream.

Detailed Description

This filter stream is used to compress a stream into a "GZIP" stream. The "GZIP" format is described in RFC 1952.

author of the original java version : John Leuner

This sample shows how to gzip a file

using System;
using System.IO;
class MainClass
{
public static void Main(string[] args)
{
using (Stream s = new GZipOutputStream(File.Create(args[0] + ".gz")))
using (FileStream fs = File.OpenRead(args[0])) {
byte[] writeData = new byte[4096];
Streamutils.Copy(s, fs, writeData);
}
}
}
} <br>
Zwipe.Test.Tools.Entities.File File
Definition ExportsTest.cs:6
GZipOutputStream(Stream baseOutputStream)
Creates a GzipOutputStream with the default buffer size.
Definition GzipOutputStream.cs:102
Definition FileSystemScanner.cs:40
Definition GZIPConstants.cs:40

Member Enumeration Documentation

◆ OutputState

Enumerator
Header 
Footer 
Finished 
Closed 

Constructor & Destructor Documentation

◆ GZipOutputStream() [1/2]

ICSharpCode.SharpZipLib.GZip.GZipOutputStream.GZipOutputStream ( Stream baseOutputStream)

Creates a GzipOutputStream with the default buffer size.

Parameters
baseOutputStreamThe stream to read data (to be compressed) from

◆ GZipOutputStream() [2/2]

ICSharpCode.SharpZipLib.GZip.GZipOutputStream.GZipOutputStream ( Stream baseOutputStream,
int size )

Creates a GZipOutputStream with the specified buffer size.

Parameters
baseOutputStreamThe stream to read data (to be compressed) from
sizeSize of the buffer to use

Member Function Documentation

◆ Close()

override void ICSharpCode.SharpZipLib.GZip.GZipOutputStream.Close ( )

Writes remaining compressed output data to the output stream and closes it.

Here is the call graph for this function:

◆ Finish()

override void ICSharpCode.SharpZipLib.GZip.GZipOutputStream.Finish ( )
virtual

Finish compression and write any footer information required to stream.

Reimplemented from ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLevel()

int ICSharpCode.SharpZipLib.GZip.GZipOutputStream.GetLevel ( )

Get the current compression level.

Returns
The current compression level.

◆ SetLevel()

void ICSharpCode.SharpZipLib.GZip.GZipOutputStream.SetLevel ( int level)

Sets the active compression level (1-9). The new level will be activated immediately.

Parameters
levelThe compression level to set.
Exceptions
ArgumentOutOfRangeExceptionLevel specified is not supported.

Deflater

◆ Write()

override void ICSharpCode.SharpZipLib.GZip.GZipOutputStream.Write ( byte[] buffer,
int offset,
int count )

Write given buffer to output updating crc.

Parameters
bufferBuffer to write
offsetOffset of first byte in buf to write
countNumber of bytes to write
Here is the call graph for this function:

◆ WriteHeader()

void ICSharpCode.SharpZipLib.GZip.GZipOutputStream.WriteHeader ( )
private
Here is the caller graph for this function:

Member Data Documentation

◆ crc

Crc32 ICSharpCode.SharpZipLib.GZip.GZipOutputStream.crc = new Crc32()
protected

CRC-32 value for uncompressed data.

◆ state_

OutputState ICSharpCode.SharpZipLib.GZip.GZipOutputStream.state_ = OutputState.Header
private

The documentation for this class was generated from the following file: