BASE64 암호화/복호화

3515 단어 base64
 1 import java.io.IOException;

 2 import sun.misc.BASE64Decoder;

 3 import sun.misc.BASE64Encoder;

 4 

 5 public class Base64Util {

 6     private static BASE64Encoder BASE64Encoder = new BASE64Encoder();

 7 

 8     private static BASE64Decoder BASE64Decoder = new BASE64Decoder();

 9 

10     /*    */

11     public static String encoder( byte[] bytes) {

12         return BASE64Encoder.encode(bytes);

13     }

14 

15     /*    */

16     public static String decoder(String str) throws IOException {

17         byte[] decodeBuffer = BASE64Decoder.decodeBuffer(str);

18         return new String(decodeBuffer);

19     }

20 

21     public static byte[] decoderByByte(String str) throws IOException {

22         return BASE64Decoder.decodeBuffer(str);

23     }

24 

25 }

좋은 웹페이지 즐겨찾기