|
Fingerprint_Card
|
This class allows us to retrieve a specified number of bits from the input buffer, as well as copy big byte blocks. More...
Public Member Functions | |
| StreamManipulator () | |
| Constructs a default StreamManipulator with all buffers empty. | |
| int | PeekBits (int bitCount) |
| Get the next sequence of bits but don't increase input pointer. bitCount must be less or equal 16 and if this call succeeds, you must drop at least n - 8 bits in the next call. | |
| void | DropBits (int bitCount) |
| Drops the next n bits from the input. You should have called PeekBits with a bigger or equal n before, to make sure that enough bits are in the bit buffer. | |
| int | GetBits (int bitCount) |
| Gets the next n bits and increases input pointer. This is equivalent to PeekBits followed by DropBits, except for correct error handling. | |
| void | SkipToByteBoundary () |
| Skips to the next byte boundary. | |
| int | CopyBytes (byte[] output, int offset, int length) |
| Copies bytes from input buffer to output buffer starting at output[offset]. You have to make sure, that the buffer is byte aligned. If not enough bytes are available, copies fewer bytes. | |
| void | Reset () |
| Resets state and empties internal buffers. | |
| void | SetInput (byte[] buffer, int offset, int count) |
| Add more input for consumption. Only call when IsNeedingInput returns true. | |
Properties | |
| int | AvailableBits [get] |
| Gets the number of bits available in the bit buffer. This must be only called when a previous PeekBits() returned -1. | |
| int | AvailableBytes [get] |
| Gets the number of bytes available. | |
| bool | IsNeedingInput [get] |
| Returns true when SetInput can be called. | |
Private Attributes | |
| byte[] | window_ |
| int | windowStart_ |
| int | windowEnd_ |
| uint | buffer_ |
| int | bitsInBuffer_ |
This class allows us to retrieve a specified number of bits from the input buffer, as well as copy big byte blocks.
It uses an int buffer to store up to 31 bits for direct manipulation. This guarantees that we can get at least 16 bits, but we only need at most 15, so this is all safe.
There are some optimizations in this class, for example, you must never peek more than 8 bits more than needed, and you must first peek bits before you may drop them. This is not a general purpose class but optimized for the behaviour of the Inflater.
authors of the original java version : John Leuner, Jochen Hoenicke
| ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.StreamManipulator | ( | ) |
Constructs a default StreamManipulator with all buffers empty.
| int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.CopyBytes | ( | byte[] | output, |
| int | offset, | ||
| int | length ) |
Copies bytes from input buffer to output buffer starting at output[offset]. You have to make sure, that the buffer is byte aligned. If not enough bytes are available, copies fewer bytes.
| output | The buffer to copy bytes to. |
| offset | The offset in the buffer at which copying starts |
| length | The length to copy, 0 is allowed. |
| ArgumentOutOfRangeException | Length is less than zero |
| InvalidOperationException | Bit buffer isnt byte aligned |

| void ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.DropBits | ( | int | bitCount | ) |
Drops the next n bits from the input. You should have called PeekBits with a bigger or equal n before, to make sure that enough bits are in the bit buffer.
| bitCount | The number of bits to drop. |

| int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.GetBits | ( | int | bitCount | ) |
| int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.PeekBits | ( | int | bitCount | ) |
Get the next sequence of bits but don't increase input pointer. bitCount must be less or equal 16 and if this call succeeds, you must drop at least n - 8 bits in the next call.
| bitCount | The number of bits to peek. |

| void ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.Reset | ( | ) |
Resets state and empties internal buffers.
| void ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.SetInput | ( | byte[] | buffer, |
| int | offset, | ||
| int | count ) |
Add more input for consumption. Only call when IsNeedingInput returns true.
| buffer | data to be input |
| offset | offset of first byte of input |
| count | number of bytes of input to add. |
| void ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.SkipToByteBoundary | ( | ) |
Skips to the next byte boundary.
|
private |
|
private |
|
private |
|
private |
|
private |
|
get |
Gets the number of bits available in the bit buffer. This must be only called when a previous PeekBits() returned -1.
|
get |
Gets the number of bytes available.
|
get |
Returns true when SetInput can be called.