public final class LZSPlus
extends java.lang.Object
Garbler
to do the encryption and LZSEncoding
to do the
compression; LZSEncoding uses the original JavaScript lz-string library almost verbatim when run on GWT, so it
performs better than code that has been compiled to JavaScript from Java by GWT, and it performs like Java when run
on a real JVM.
Constructor and Description |
---|
LZSPlus() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
compress(java.lang.String uncompressedStr)
Compresses the given text using LZ-String compression; does not encrypt the result.
|
static java.lang.String |
compress(java.lang.String uncompressedStr,
long[] keys)
Compresses the given text using LZ-String compression and encrypts (somewhat) the compressed result so it can't
be read back without the same keys as a long array.
|
static java.lang.String |
decompress(java.lang.String compressed)
Decompresses text that was compressed with LZ-String compression; does not reverse decryption so it can only
decompress Strings produced by
compress(String) , or compress(String, long[]) with an empty or
null keys parameter. |
static java.lang.String |
decompress(java.lang.String compressed,
long[] keys)
Decompresses text that was compressed with LZ-String compression, reversing any encryption if the keys long array
matches the long array passed to
compress(String, long[]) (keys can be null if no array was passed). |
public static java.lang.String compress(java.lang.String uncompressedStr)
uncompressedStr
- text to compresspublic static java.lang.String compress(java.lang.String uncompressedStr, long[] keys)
Garbler.makeKeyArray(int, String)
; the size parameter could reasonably be anywhere from 2 to 32. If the
keys array is null or empty, this only compresses and does not perform an additional encryption step.uncompressedStr
- text to compress and optionally encryptkeys
- the long array that will be used to encrypt the output, and will be required to decrypt the result; may be nullpublic static java.lang.String decompress(java.lang.String compressed)
compress(String)
, or compress(String, long[])
with an empty or
null keys parameter.compressed
- text that was compressed by compress(String)
public static java.lang.String decompress(java.lang.String compressed, long[] keys)
compress(String, long[])
(keys can be null if no array was passed).compressed
- text that was compressed by compress(String, long[])
keys
- the long array that was used to encrypt the output, and must match to decrypt the result; may be nullCopyright © Eben Howard 2012–2022. All rights reserved.