![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Lianja) Compress String Feed to Base64This example receives incoming text data in chunks, compresses as a stream, and accumulates the compressed data in base64. Note: This example requires Chilkat v11.0.0 or greater.
llSuccess = .F. // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loSbCompressedBase64 = createobject("CkStringBuilder") loCompress = createobject("CkCompression") loCompress.Algorithm = "deflate" loCompress.Charset = "utf-8" loCompress.EncodingMode = "base64" loCompress.FirstChunk = .T. loCompress.LastChunk = .F. loBdCompressed = createobject("CkBinData") loSbUncompressedChunk = createobject("CkStringBuilder") for i = 0 to 24 if (i = 24) then loCompress.LastChunk = .T. endif loSbUncompressedChunk.Clear() loSbUncompressedChunk.AppendInt(i) loSbUncompressedChunk.Append(": This is a line of data to be compressed..." + Chr(13) + Chr(10)) loCompress.CompressSb(loSbUncompressedChunk,loBdCompressed) loCompress.FirstChunk = .F. next ? "The base64 encoded compressed text:" ? loBdCompressed.GetEncoded("base64") // Decompress in one call: lcOriginalText = loCompress.DecompressStringENC(loBdCompressed.GetEncoded("base64")) ? lcOriginalText release loSbCompressedBase64 release loCompress release loBdCompressed release loSbUncompressedChunk |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.