Java
Java
Example: Crypt2.DecodeString method
Demonstrates how to call the DecodeString method.Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkCrypt2 crypt2 = new CkCrypt2();
// The string "Hello World" in base64 (using the utf-8 byte representation) is "SGVsbG8gV29ybGQ="
String encodedStr = "SGVsbG8gV29ybGQ=";
String encoding = "base64";
String charset = "utf-8";
String str = crypt2.decodeString(encodedStr,charset,encoding);
System.out.println(str);
// Output is "Hello World"
}
}