Initialize the ZlibCodec for deflation operation.
Syntax
Visual Basic (Declaration) | |
---|
Public Overloads Function InitializeDeflate() As Integer |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As ZlibCodec
Dim value As Integer
value = instance.InitializeDeflate() |
C# | |
---|
public int InitializeDeflate() |
C++/CLI | |
---|
public:
int InitializeDeflate(); |
Return Value
Z_OK if all goes well. You generally don't need to check the return code.
Example
C# | Copy Code |
---|
int bufferSize = 40000;
byte[] CompressedBytes = new byte[bufferSize];
byte[] DecompressedBytes = new byte[bufferSize];
ZlibCodec compressor = new ZlibCodec();
compressor.InitializeDeflate(CompressionLevel.Default);
compressor.InputBuffer = System.Text.ASCIIEncoding.ASCII.GetBytes(TextToCompress);
compressor.NextIn = 0;
compressor.AvailableBytesIn = compressor.InputBuffer.Length;
compressor.OutputBuffer = CompressedBytes;
compressor.NextOut = 0;
compressor.AvailableBytesOut = CompressedBytes.Length;
while (compressor.TotalBytesIn != TextToCompress.Length && compressor.TotalBytesOut < bufferSize)
{
compressor.Deflate(FlushType.None);
}
while (true)
{
int rc= compressor.Deflate(FlushType.Finish);
if (rc == ZlibConstants.Z_STREAM_END) break;
}
compressor.EndDeflate(); |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also