Class PendingBuffer
This class is general purpose class for writing data to a buffer.
It allows you to write bits as well as bytes Based on DeflaterPending.java
author of the original java version : Jochen Hoenicke
Inherited Members
Namespace: ICSharpCode.SharpZipLib.Zip.Compression
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class PendingBuffer
Constructors
| Improve this Doc View SourcePendingBuffer()
construct instance using default buffer size of 4096
Declaration
public PendingBuffer()
PendingBuffer(Int32)
construct instance using specified buffer size
Declaration
public PendingBuffer(int bufferSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | bufferSize | size to use for internal buffer |
Properties
| Improve this Doc View SourceBitCount
The number of bits written to the buffer
Declaration
public int BitCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsFlushed
Indicates if buffer has been flushed
Declaration
public bool IsFlushed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceAlignToByte()
Align internal buffer on a byte boundary
Declaration
public void AlignToByte()
Flush(Byte[], Int32, Int32)
Flushes the pending buffer into the given output array. If the output array is to small, only a partial flush is done.
Declaration
public int Flush(byte[] output, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | output | The output array. |
System.Int32 | offset | The offset into output array. |
System.Int32 | length | The maximum number of bytes to store. |
Returns
Type | Description |
---|---|
System.Int32 | The number of bytes flushed. |
Reset()
Clear internal state/buffers
Declaration
public void Reset()
ToByteArray()
Convert internal buffer to byte array. Buffer is empty on completion
Declaration
public byte[] ToByteArray()
Returns
Type | Description |
---|---|
System.Byte[] | The internal buffer contents converted to a byte array. |
WriteBits(Int32, Int32)
Write bits to internal buffer
Declaration
public void WriteBits(int b, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | b | source of bits |
System.Int32 | count | number of bits to write |
WriteBlock(Byte[], Int32, Int32)
Write a block of data to buffer
Declaration
public void WriteBlock(byte[] block, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | block | data to write |
System.Int32 | offset | offset of first byte to write |
System.Int32 | length | number of bytes to write |
WriteByte(Int32)
Write a byte to buffer
Declaration
public void WriteByte(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value to write |
WriteInt(Int32)
write an integer LSB first
Declaration
public void WriteInt(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value to write. |
WriteShort(Int32)
Write a short value to buffer LSB first
Declaration
public void WriteShort(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value to write. |
WriteShortMSB(Int32)
Write a short value to internal buffer most significant byte first
Declaration
public void WriteShortMSB(int s)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | s | value to write |