![]() |
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
(Visual FoxPro) Transition from BeginCompressStringENC to FirstChunk/LastChunkProvides instructions for replacing deprecated BeginCompressStringENC method calls with using FirstChunk/LastChunk properties. Note: This example requires Chilkat v11.0.0 or greater.
LOCAL lnSuccess LOCAL loSbCompressedBase64 LOCAL loCompress LOCAL loSbIndex LOCAL i LOCAL lcOriginalText LOCAL loBdCompressed LOCAL loSbUncompressedChunk lnSuccess = 0 * This example assumes the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. loSbCompressedBase64 = CreateObject('Chilkat.StringBuilder') loCompress = CreateObject('Chilkat.Compression') loCompress.Algorithm = "deflate" loCompress.Charset = "utf-8" loCompress.EncodingMode = "base64" loSbIndex = CreateObject('Chilkat.StringBuilder') * ---------------------------------------------------------------------------------- * This is the deprecated way of compressing in chunks using Begin/More/End methods.. * ---------------------------------------------------------------------------------- FOR i = 0 TO 24 * Note: It is possible (and normal) for a BeginCompress* or MoreCompress* method to return * an empty string (or 0 bytes). When this happens, the input data is not lost. It will be flushed * in a subsequent call. loSbIndex.Clear() loSbIndex.AppendInt(i) IF (i = 0) THEN loSbCompressedBase64.Append(loCompress.BeginCompressStringENC(loSbIndex.GetAsString())) ELSE loSbCompressedBase64.Append(loCompress.MoreCompressStringENC(loSbIndex.GetAsString())) ENDIF loSbCompressedBase64.Append(loCompress.MoreCompressStringENC(": This is a line of data to be compressed..." + CHR(13) + CHR(10))) NEXT * Flush any remaining output. loSbCompressedBase64.Append(loCompress.EndCompressStringENC()) ? "The base64 encoded compressed text:" ? loSbCompressedBase64.GetAsString() * Decompress in one call: lcOriginalText = loCompress.DecompressStringENC(loSbCompressedBase64.GetAsString()) ? lcOriginalText * ---------------------------------------------------------------------------------- * This is new way of compressing in chunks using FirstChunk and LastChunk properties * ---------------------------------------------------------------------------------- loSbCompressedBase64.Clear() loCompress.FirstChunk = 1 loCompress.LastChunk = 0 loBdCompressed = CreateObject('Chilkat.BinData') loSbUncompressedChunk = CreateObject('Chilkat.StringBuilder') FOR i = 0 TO 24 IF (i = 24) THEN loCompress.LastChunk = 1 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 = 0 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 loSbIndex RELEASE loBdCompressed RELEASE loSbUncompressedChunk |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.