view src/goodjava/util/GoodUtils.java @ 1640:570f3d483a31

host - move https.luan into src
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 21 Dec 2021 16:54:26 -0700
parents 1cc6c7fa803d
children 2f4c99c02436
line wrap: on
line source

package goodjava.util;

import java.io.UnsupportedEncodingException;
import java.util.Base64;


public final class GoodUtils {

	public static byte[] getBytes(String s,String charsetName) {
		try {
			return s.getBytes(charsetName);
		} catch(UnsupportedEncodingException e) {
			throw new RuntimeException(e);
		}
	}

	public static String base64Encode(String s) {
		return Base64.getEncoder().encodeToString(getBytes(s,"UTF-8"));
	}
}