Keyoti RapidSpell Desktop .NET API Docs
Inflate Method (flush)
APIKeyoti.RapidSpell.CompressionZlibCodecInflate(FlushType)
Keyoti RapidSpell Desktop .NET
Inflate the data in the InputBuffer, placing the result in the OutputBuffer.
Declaration Syntax
C#C#Visual BasicVisual BasicVisual C++Visual C++F#F#
public int Inflate(
	FlushType flush
)
public int Inflate(
	FlushType flush
)
Public Function Inflate ( 
	flush As FlushType
) As Integer
Public Function Inflate ( 
	flush As FlushType
) As Integer
public:
int Inflate(
	FlushType flush
)
public:
int Inflate(
	FlushType flush
)
member Inflate : 
        flush : FlushType -> int 
member Inflate : 
        flush : FlushType -> int 
Parameters
flush (FlushType)
The flush to use when inflating.
Return Value
Int32
Z_OK if everything goes well.
Remarks
You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and AvailableBytesOut before calling this method.
Examples
 Copy imageCopy
private void InflateBuffer()
{
    int bufferSize = 1024;
    byte[] buffer = new byte[bufferSize];
    ZlibCodec decompressor = new ZlibCodec();

    Console.WriteLine("\n============================================");
    Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length);
    MemoryStream ms = new MemoryStream(DecompressedBytes);

    int rc = decompressor.InitializeInflate();

    decompressor.InputBuffer = CompressedBytes;
    decompressor.NextIn = 0;
    decompressor.AvailableBytesIn = CompressedBytes.Length;

    decompressor.OutputBuffer = buffer;

    // pass 1: inflate 
    do
    {
        decompressor.NextOut = 0;
        decompressor.AvailableBytesOut = buffer.Length;
        rc = decompressor.Inflate(FlushType.None);

        if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
            throw new Exception("inflating: " + decompressor.Message);

        ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut);
    }
    while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0);

    // pass 2: finish and flush
    do
    {
        decompressor.NextOut = 0;
        decompressor.AvailableBytesOut = buffer.Length;
        rc = decompressor.Inflate(FlushType.Finish);

        if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
            throw new Exception("inflating: " + decompressor.Message);

        if (buffer.Length - decompressor.AvailableBytesOut > 0)
            ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut);
    }
    while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0);

    decompressor.EndInflate();
}

Assembly: Keyoti.RapidSpell.NET4 (Module: Keyoti.RapidSpell.NET4.dll) Version: 6.2.21.412