public static InputStream toInputStream(String input, String encoding) throws IOException {
        byte[] bytes = input.getBytes(Charsets.toCharset(encoding));
        return new ByteArrayInputStream(bytes);
    }
Convert the specified string to an input stream, encoded as bytes
using the specified character encoding.
<p>
Character encoding names can be found at
<a href="http://www.iana.org/assignments/character-sets">IANA</a>.

@param input    the string to convert
@param encoding the encoding to use, null means platform default
@return an input stream
@throws IOException                 if the encoding is invalid
@throws UnsupportedCharsetException thrown instead of {@link UnsupportedEncodingException} in version 2.2 if the encoding is not
                                    supported.
@since 1.1
pay-java-common/src/main/java/com/egzosn/pay/common/util/IOUtils.java