Rizin
unix-like reverse engineering framework and cli tools
|
Implements the common functionality needed for all Codecs More...
Public Member Functions | |
CodecBase () | |
Initializes a new instance of the CodeBase class. More... | |
void | Add (byte[] data) |
Adds more data to the codec to be processed. More... | |
abstract void | Add (byte[] data, int offset, int count) |
Adds more data to the codec to be processed. More... | |
abstract void | Finish () |
Finishes up any pending data that needs to be processed and handled. More... | |
void | Dispose () |
Releases any unmanaged resources and calls the CleanUp() method of the derived class More... | |
Protected Member Functions | |
void | OnDataAvailable () |
Fires the DataAvailable event More... | |
abstract void | CleanUp () |
Performs any codec specific cleanup More... | |
void | copyInput (byte[] data, int startIndex, int count) |
Copies a number of bytes to the internal codec buffer - ready for proccesing More... | |
void | resetOutput () |
Resets the internal output buffers to a known state - ready for processing More... | |
void | setChecksum (uint newSum) |
Updates the running checksum property More... | |
Protected Attributes | |
bool | _isDisposed = false |
True if the object instance has been disposed, false otherwise More... | |
Static Protected Attributes | |
const int | kBufferSize = 16384 |
The size of the internal buffers More... | |
Package Attributes | |
ZStream | _ztream = new ZStream() |
Instance of the internal zlib buffer structure that is passed to all functions in the zlib dll More... | |
Properties | |
uint | Checksum [get] |
Gets the checksum of the data that has been added so far More... | |
Properties inherited from DotZLib.Codec | |
uint | Checksum [get] |
Gets the checksum of the data that has been added so far More... | |
Events | |
DataAvailableHandler | DataAvailable |
Occurs when more processed data are available. More... | |
Events inherited from DotZLib.Codec | |
DataAvailableHandler | DataAvailable |
Occurs when more processed data are available. More... | |
Private Member Functions | |
~CodecBase () | |
Destroys this instance More... | |
void | CleanUp (bool isDisposing) |
Private Attributes | |
byte[] | _outBuffer = new byte[kBufferSize] |
byte[] | _inBuffer = new byte[kBufferSize] |
GCHandle | _hInput |
GCHandle | _hOutput |
uint | _checksum = 0 |
Implements the common functionality needed for all Codecs
Definition at line 16 of file CodecBase.cs.
|
inline |
Initializes a new instance of the CodeBase
class.
Definition at line 50 of file CodecBase.cs.
References DotZLib.CodecBase._hInput, DotZLib.CodecBase._hOutput, DotZLib.CodecBase._inBuffer, DotZLib.CodecBase._outBuffer, and DotZLib.CodecBase.CleanUp().
|
inlineprivate |
Destroys this instance
Definition at line 123 of file CodecBase.cs.
References DotZLib.CodecBase.CleanUp().
|
inline |
Adds more data to the codec to be processed.
data | Byte array containing the data to be added to the codec |
Adding data may, or may not, raise the DataAvailable
event
Implements DotZLib.Codec.
Definition at line 90 of file CodecBase.cs.
Adds more data to the codec to be processed.
data | Byte array containing the data to be added to the codec |
offset | The index of the first byte to add from data |
count | The number of bytes to add |
Adding data may, or may not, raise the DataAvailable
event
This must be implemented by a derived class
Implements DotZLib.Codec.
Implemented in DotZLib.Inflater, and DotZLib.Deflater.
|
protectedpure virtual |
Performs any codec specific cleanup
This must be implemented by a derived class
Implemented in DotZLib.Inflater, and DotZLib.Deflater.
Referenced by DotZLib.CodecBase.CleanUp(), DotZLib.CodecBase.CodecBase(), DotZLib.CodecBase.Dispose(), and DotZLib.CodecBase.~CodecBase().
|
inlineprivate |
Definition at line 143 of file CodecBase.cs.
References DotZLib.CodecBase._hInput, DotZLib.CodecBase._hOutput, DotZLib.CodecBase._isDisposed, and DotZLib.CodecBase.CleanUp().
Copies a number of bytes to the internal codec buffer - ready for proccesing
data | The byte array that contains the data to copy |
startIndex | The index of the first byte to copy |
count | The number of bytes to copy from data |
Definition at line 168 of file CodecBase.cs.
References DotZLib.CodecBase._hInput, DotZLib.CodecBase._inBuffer, DotZLib.CodecBase._ztream, Array, DotZLib.ZStream.avail_in, count, DotZLib.ZStream.next_in, and DotZLib.ZStream.total_in.
Referenced by DotZLib.Deflater.Add(), and DotZLib.Inflater.Add().
|
inline |
Releases any unmanaged resources and calls the CleanUp() method of the derived class
Definition at line 131 of file CodecBase.cs.
References DotZLib.CodecBase.CleanUp().
|
pure virtual |
Finishes up any pending data that needs to be processed and handled.
This must be implemented by a derived class
Implements DotZLib.Codec.
Implemented in DotZLib.Inflater, and DotZLib.Deflater.
|
inlineprotected |
Fires the DataAvailable event
Definition at line 75 of file CodecBase.cs.
References DotZLib.CodecBase._outBuffer, DotZLib.CodecBase._ztream, DotZLib.CodecBase.DataAvailable, DotZLib.CodecBase.resetOutput(), and DotZLib.ZStream.total_out.
Referenced by DotZLib.Deflater.Add(), DotZLib.Inflater.Add(), DotZLib.Deflater.Finish(), and DotZLib.Inflater.Finish().
|
inlineprotected |
Resets the internal output buffers to a known state - ready for processing
Definition at line 180 of file CodecBase.cs.
References DotZLib.CodecBase._hOutput, DotZLib.CodecBase._ztream, DotZLib.ZStream.avail_out, DotZLib.CodecBase.kBufferSize, DotZLib.ZStream.next_out, and DotZLib.ZStream.total_out.
Referenced by DotZLib.Deflater.Deflater(), DotZLib.Deflater.Finish(), DotZLib.Inflater.Finish(), DotZLib.Inflater.Inflater(), and DotZLib.CodecBase.OnDataAvailable().
|
inlineprotected |
Updates the running checksum property
newSum | The new checksum value |
Definition at line 191 of file CodecBase.cs.
References DotZLib.CodecBase._checksum.
Referenced by DotZLib.Deflater.Add(), DotZLib.Inflater.Add(), DotZLib.Deflater.Finish(), and DotZLib.Inflater.Finish().
|
private |
Definition at line 43 of file CodecBase.cs.
Referenced by DotZLib.CodecBase.setChecksum().
|
private |
Definition at line 40 of file CodecBase.cs.
Referenced by DotZLib.CodecBase.CleanUp(), DotZLib.CodecBase.CodecBase(), and DotZLib.CodecBase.copyInput().
|
private |
Definition at line 41 of file CodecBase.cs.
Referenced by DotZLib.CodecBase.CleanUp(), DotZLib.CodecBase.CodecBase(), and DotZLib.CodecBase.resetOutput().
|
private |
Definition at line 38 of file CodecBase.cs.
Referenced by DotZLib.CodecBase.CodecBase(), and DotZLib.CodecBase.copyInput().
True if the object instance has been disposed, false otherwise
Definition at line 30 of file CodecBase.cs.
Referenced by DotZLib.CodecBase.CleanUp().
|
private |
Definition at line 37 of file CodecBase.cs.
Referenced by DotZLib.CodecBase.CodecBase(), and DotZLib.CodecBase.OnDataAvailable().
Instance of the internal zlib buffer structure that is passed to all functions in the zlib dll
Definition at line 25 of file CodecBase.cs.
Referenced by DotZLib.Deflater.Add(), DotZLib.Inflater.Add(), DotZLib.Deflater.CleanUp(), DotZLib.Inflater.CleanUp(), DotZLib.CodecBase.copyInput(), DotZLib.Deflater.Deflater(), DotZLib.Deflater.Finish(), DotZLib.Inflater.Finish(), DotZLib.Inflater.Inflater(), DotZLib.CodecBase.OnDataAvailable(), and DotZLib.CodecBase.resetOutput().
The size of the internal buffers
Definition at line 35 of file CodecBase.cs.
Referenced by DotZLib.Deflater.Add(), DotZLib.Inflater.Add(), and DotZLib.CodecBase.resetOutput().
|
get |
Gets the checksum of the data that has been added so far
Definition at line 114 of file CodecBase.cs.
DataAvailableHandler DotZLib.CodecBase.DataAvailable |
Occurs when more processed data are available.
Definition at line 70 of file CodecBase.cs.
Referenced by DotZLib.CodecBase.OnDataAvailable().