public class GZIPString extends Object implements Serializable
GZIPString compressed = new GZIPString("This is a test");Behind the scenes, the GZIPString can compress the string, saving precious memory. The caller does not (need to) know whether compression is in effect or not. To retrieve the original string, simply call the toString() method:
System.out.println("The original string was " + compressed.toString);or even:
System.out.println("The original string was " + compressed);If the original string is null, then toString will subsequently return null.
Constructor and Description |
---|
GZIPString(String s)
Creates a compressed string if the string is larger than 512 characters (1 kilobyte).
|
GZIPString(String s,
int threshold)
Creates a compressed string if the size of the string is larger than
threshold characters. |
Modifier and Type | Method and Description |
---|---|
static String |
backToString(GZIPString gs)
Safely return the original string, or null if
gs is null. |
String |
toString()
Recreate the original string as sent in to the constructor.
|
public GZIPString(String s)
public GZIPString(String s, int threshold)
threshold
characters.public String toString()
public static String backToString(GZIPString gs)
gs
is null.© 1998- 2021 Escenic AS