본문 바로가기

개발자愛/JAVA

JAVA base64 incoding decoding

public static String base64Decode(String str) {
    String result = "";
    try {
      sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
      byte[] b1 = decoder.decodeBuffer(str);
      result = new String(b1);
    } catch (IOException ex) {}
    return result;
  }





public static String base64Encode(String str) {
    String result = "";
    sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
    byte[] b1 = str.getBytes();
    result = encoder.encode(b1);
    return result;
  }


invalid-file

Base64EDCoder.zip