Fingerprint_Card

Loading...
Searching...
No Matches
ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator Class Reference

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_

## Detailed Description

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

## Constructor & Destructor Documentation

## ◆ StreamManipulator()

ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.StreamManipulator | ( |  | ) |

Constructs a default StreamManipulator with all buffers empty.

## Member Function Documentation

## ◆ CopyBytes()

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.

Parameters

  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.

Returns
  The number of bytes copied, 0 if no bytes were available.

Exceptions

  ArgumentOutOfRangeException | Length is less than zero
  InvalidOperationException | Bit buffer isnt byte aligned

Here is the caller graph for this function:

## ◆ DropBits()

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.

Parameters

  bitCount | The number of bits to drop.

Here is the caller graph for this function:

## ◆ GetBits()

int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.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.

Parameters

  bitCount | The number of bits to retrieve.

Returns
  the value of the bits, or -1 if not enough bits available.

Here is the call graph for this function:

## ◆ PeekBits()

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.

Parameters

  bitCount | The number of bits to peek.

Returns
  the value of the bits, or -1 if not enough bits available. *‍/

Here is the caller graph for this function:

## ◆ Reset()

void ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.Reset | ( |  | ) |

Resets state and empties internal buffers.

## ◆ SetInput()

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.

Parameters

  buffer | data to be input
  offset | offset of first byte of input
  count | number of bytes of input to add.

## ◆ SkipToByteBoundary()

void ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.SkipToByteBoundary | ( |  | ) |

Skips to the next byte boundary.

## Member Data Documentation

## ◆ bitsInBuffer_

int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.bitsInBuffer_
| private

## ◆ buffer_

uint ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.buffer_
| private

## ◆ window_

byte [] ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.window_
| private

## ◆ windowEnd_

int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.windowEnd_
| private

## ◆ windowStart_

int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.windowStart_
| private

## Property Documentation

## ◆ AvailableBits

int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.AvailableBits
| get

Gets the number of bits available in the bit buffer. This must be only called when a previous PeekBits() returned -1.

Returns
  the number of bits available.

## ◆ AvailableBytes

int ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.AvailableBytes
| get

Gets the number of bytes available.

Returns
  The number of bytes available.

## ◆ IsNeedingInput

bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator.IsNeedingInput
| get

Returns true when SetInput can be called.

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

- ICSharpCode.SharpZLib/Zip/Compression/Streams/StreamManipulator.cs