001package com.nimbusds.jose.util;
002
003
004import java.nio.charset.Charset;
005
006
007/**
008 * String utilities.
009 *
010 * @author Vladimir Dzhuvinov
011 * @version $version$ (2013-05-16)
012 */
013public class StringUtils {
014
015
016        /**
017         * Converts the specified string to a byte array.
018         *
019         * @param s The input string to convert. Must be UTF-8 encoded and not
020         *          {@code null}.
021         *
022         * @return The resulting byte array.
023         */
024        public static byte[] toByteArray(final String s) {
025
026                return s.getBytes(Charset.forName("UTF-8"));
027        }
028
029
030        /**
031         * Prevents public instantiation.
032         */
033        private StringUtils() {
034
035        }
036}