(Go) Decompress Bytes
Demonstrates how to decompress binary data.
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// See this example to compress bytes: Compress Bytes
fac := chilkat.NewFileAccess()
compressedBytes = fac.ReadEntireFile("qa_data/compressed/compressedBmp.dat")
if fac.LastMethodSuccess() != true {
fmt.Println(fac.LastErrorText())
fac.DisposeFileAccess()
return
}
compress := chilkat.NewCompression()
compress.SetAlgorithm("deflate")
decompressedBytes = compress.DecompressBytes(compressedBytes)
if compress.LastMethodSuccess() != true {
fmt.Println(compress.LastErrorText())
fac.DisposeFileAccess()
compress.DisposeCompression()
return
}
success := fac.WriteEntireFile("qa_output/decompressed.bmp",decompressedBytes)
if fac.LastMethodSuccess() != true {
fmt.Println(fac.LastErrorText())
fac.DisposeFileAccess()
compress.DisposeCompression()
return
}
fac.DisposeFileAccess()
compress.DisposeCompression()
|