    001package org.apache.commons.ssl.util;
    002
    003import java.io.UnsupportedEncodingException;
    004
    005public class UTF8 {
    006
    007    public static String toString(byte[] bytes) {
    008        try {
    009            return new String(bytes, "UTF-8");
    010        } catch (UnsupportedEncodingException uee) {
    011            throw new RuntimeException("UTF8 unavailable", uee);
    012        }
    013    }
    014
    015    public static byte[] toBytes(String s) {
    016        try {
    017            return s.getBytes("UTF-8");
    018        } catch (UnsupportedEncodingException uee) {
    019            throw new RuntimeException("UTF8 unavailable", uee);
    020        }
    021    }
    022}