자바 base64 encode()

1 개요[ | ]

자바 base64_encode()
import java.util.Base64;
public class MyClass {
    public static void main(String args[]) {
        System.out.println( new String(Base64.getEncoder().encode("This is an encoded string".getBytes())) );
        System.out.println( new String(Base64.getEncoder().encode("★A가あ中".getBytes())) );
        // VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
        // 4piFQeqwgOOBguS4rQ==
    }
}
private static String base64_encode(String str) {
	return new String(Base64.getEncoder().encode(str.getBytes()));
}
private static String base64_encode(byte[] bytes) {
	return new String(Base64.getEncoder().encode(bytes));
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}