C# Class TrainerEditor.CompressionFormat

Base class for all compression formats.
显示文件 Open project: Jambo51/Trainer_Editor

Public Methods

Method Description
Compress ( Stream instream, long inLength, Stream outstream ) : int

Compresses the next inLength bytes from the input stream, and writes the compressed data to the given output stream.

Compress ( string infile, string outfile ) : int

Compresses the given input file, and writes the compressed data to the given output file.

Decompress ( Stream instream, long inLength, Stream outstream ) : long

Decompresses the given stream, writing the decompressed data to the given output stream. Assumes Supports(instream) returns true. After this call, the input stream will be positioned at the end of the compressed stream, or at the initial position + inLength, whichever comes first.

Decompress ( string infile, string outfile ) : void

Decompresses the given file, writing the deocmpressed data to the given output file. The output file will be overwritten if it already exists. Assumes Supports(infile) returns true.

ParseCompressionOptions ( string args ) : int

Parses any input specific for this format. Does nothing by default.

Supports ( Stream stream, long inLength ) : bool

Checks if the decompressor for this format supports the data from the given stream. Returns false when it is certain that the given data is not supported. False positives may occur, as this method should not do any decompression, and may mis-interpret a similar data format as compressed.

Supports ( string file ) : bool

Checks if the decompressor for this format supports the given file. Assumes the file exists. Returns false when it is certain that the given file is not supported. False positives may occur, as this method should not do any decompression, and may mis-interpret a similar file format as compressed.

Method Details

Compress() public abstract method

Compresses the next inLength bytes from the input stream, and writes the compressed data to the given output stream.
public abstract Compress ( Stream instream, long inLength, Stream outstream ) : int
instream Stream The stream to read plaintext data from.
inLength long The length of the plaintext data.
outstream Stream The stream to write the compressed data to.
return int

Compress() public method

Compresses the given input file, and writes the compressed data to the given output file.
public Compress ( string infile, string outfile ) : int
infile string The file to compress.
outfile string The file to write the compressed data to.
return int

Decompress() public abstract method

Decompresses the given stream, writing the decompressed data to the given output stream. Assumes Supports(instream) returns true. After this call, the input stream will be positioned at the end of the compressed stream, or at the initial position + inLength, whichever comes first.
When the given length of the input data /// is not enough to properly decompress the input.
public abstract Decompress ( Stream instream, long inLength, Stream outstream ) : long
instream Stream The stream to decompress. At the end of this method, the position /// of this stream is directly after the compressed data.
inLength long The length of the input data. Not necessarily all of the /// input data may be read (if there is padding, for example), however never more than /// this number of bytes is read from the input stream.
outstream Stream The stream to write the decompressed data to.
return long

Decompress() public method

Decompresses the given file, writing the deocmpressed data to the given output file. The output file will be overwritten if it already exists. Assumes Supports(infile) returns true.
public Decompress ( string infile, string outfile ) : void
infile string The file to decompress.
outfile string The target location of the decompressed file.
return void

ParseCompressionOptions() public method

Parses any input specific for this format. Does nothing by default.
public ParseCompressionOptions ( string args ) : int
args string Any arguments that may be used by the format.
return int

Supports() public abstract method

Checks if the decompressor for this format supports the data from the given stream. Returns false when it is certain that the given data is not supported. False positives may occur, as this method should not do any decompression, and may mis-interpret a similar data format as compressed.
public abstract Supports ( Stream stream, long inLength ) : bool
stream Stream The stream that may or may not contain compressed data. The /// position of this stream may change during this call, but will be returned to its /// original position when the method returns.
inLength long The length of the input stream.
return bool

Supports() public method

Checks if the decompressor for this format supports the given file. Assumes the file exists. Returns false when it is certain that the given file is not supported. False positives may occur, as this method should not do any decompression, and may mis-interpret a similar file format as compressed.
public Supports ( string file ) : bool
file string The name of the file to check.
return bool