X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FStringUtils.java;h=a6117a04053e863b3d9952c4fccd33f0533f33c7;hp=acd632aa1968c50fa631131b3f9b216da6e2f001;hb=805005449dacb1e7b825db63836bf100e472ddd0;hpb=f4053377fa15da2f11e82955bfab86e673fa371c diff --git a/src/be/nikiroo/utils/StringUtils.java b/src/be/nikiroo/utils/StringUtils.java index acd632a..a6117a0 100644 --- a/src/be/nikiroo/utils/StringUtils.java +++ b/src/be/nikiroo/utils/StringUtils.java @@ -300,6 +300,14 @@ public class StringUtils { HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); } + /** + * Zip the data and then encode it into Base64. + * + * @param data + * the data + * + * @return the Base64 zipped version + */ public static String zip64(String data) { try { return Base64.encodeBytes(data.getBytes(), Base64.GZIP); @@ -309,6 +317,17 @@ public class StringUtils { } } + /** + * Unconvert from Base64 then unzip the content. + * + * @param data + * the data in Base64 format + * + * @return the raw data + * + * @throws IOException + * in case of I/O error + */ public static String unzip64(String data) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(Base64.decode(data, Base64.GZIP));