org.apache.commons.ssl.util.UTF8 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of not-going-to-be-commons-ssl Show documentation
Show all versions of not-going-to-be-commons-ssl Show documentation
A Java 9+ compliant fork of Not-Yet-Commons-SSL
The newest version!
package org.apache.commons.ssl.util;
import java.io.UnsupportedEncodingException;
public class UTF8 {
public static String toString(byte[] bytes) {
try {
return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException uee) {
throw new RuntimeException("UTF8 unavailable", uee);
}
}
public static byte[] toBytes(String s) {
try {
return s.getBytes("UTF-8");
} catch (UnsupportedEncodingException uee) {
throw new RuntimeException("UTF8 unavailable", uee);
}
}
}