GGYU
base64 사용법 본문
public static void base64() {
String text = "ktko";
byte[] targetBytes = text.getBytes();
// Base64 인코딩 ///////////////////////////////////////////////////
Encoder encoder = Base64.getEncoder();
byte[] encodedBytes = encoder.encode(targetBytes);
// Base64 디코딩 ///////////////////////////////////////////////////
Decoder decoder = Base64.getDecoder();
byte[] decodedBytes = decoder.decode(encodedBytes);
System.out.println("인코딩 전 : " + text);
System.out.println("인코딩 text : " + new String(encodedBytes));
System.out.println("디코딩 text : " + new String(decodedBytes));
}
'프로그래밍 > JAVA' 카테고리의 다른 글
체인코드 (0) | 2018.07.19 |
---|---|
sha512 예제 (0) | 2018.07.19 |
서버/클라이언트 예제 (0) | 2018.07.19 |
크리티컬섹션 처리 (0) | 2018.07.19 |
thread 사용법 (0) | 2018.07.19 |
Comments