Smart.Framework Logo

final class \SmartModExtLib\JsComponents\ArchLzs
{ } ::

Class: ArchLzs - Compress or Decompress a LZS archive.
This is very slow with large strings ... extremely slow !!!
This is why the max (hardcoded) length of the string it can compress/decompress is 4096 bytes
The purpose of this class is to compress/decompress cookies that can be shared also with Javascript
The Javascript version of this class is available in modules/mod-js-components/views/js/arch-lzs/arch-lzs.js


class Methods

public static function compressToBase64 ( STRING $input ) {} :: STRING
@return: {STRING} The Base64 LZS Compressed String
@param: {STRING} $input: The uncompressed string
Compress a string to LZS + Base64
public static function decompressFromBase64 ( STRING $input ) {} :: STRING
@return: {STRING} The uncompressed string
@param: {STRING} $input: The Base64 LZS Compressed String
Decompress a Base64 + LZS compressed string

class Properties


class Constants


Sample code: PHP

<?php

// Usage example:
 
$myString 'Some string to archive as LZS';
 
$archString \SmartModExtLib\JsComponents\ArchLzs::compressToBase64($myString); // archive the string
 
$unarchString \SmartModExtLib\JsComponents\ArchLzs::decompressFromBase64($archString); // unarchive it back
 
if((string)$unarchString !== (string)$myString) { // Test: check if unarchive is the same as archive
     
@http_response_code(500);
     die(
'LZS Archive test Failed !');
 } 
//end if

// #end php code


documentation generated on: 2023-10-19 23:15:59 +0000


Smart.Framework © 2009-2023 unix-world.org