import java.io.IOException;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
public class HelloWorld{
public static void main(String []args){
String txtPlain = "베이스64 인코딩, 디코딩 테스트입니다.";
String txtCipher_utf16be = "";
String txtCipher_utf16le = "";
String txtCipher_utf8 = "";
String txtResult;
System.out.println("Source String : " + txtPlain);
try {
txtCipher_utf8 = Base64.encode(txtPlain.getBytes("UTF-8"));
System.out.println("Encode Base64 utf8: " + txtCipher_utf8);
txtCipher_utf16be = Base64.encode(txtPlain.getBytes("UTF-16BE"));
System.out.println("Encode Base64 utf16be: " + txtCipher_utf16be);
txtCipher_utf16le = Base64.encode(txtPlain.getBytes("UTF-16LE"));
System.out.println("Encode Base64 utf16le: " + txtCipher_utf16le);
txtResult = new String(Base64.decode(txtCipher_utf8));
System.out.println("Decode Base64 utf8: " + txtResult);
txtResult = new String(Base64.decode(txtCipher_utf16be), "UTF-16BE");
System.out.println("Decode Base64 utf16be: " + txtResult);
txtResult = new String(Base64.decode(txtCipher_utf16le), "UTF-16LE");
System.out.println("Decode Base64 utf16le: " + txtResult);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}