Get InputStream from a StringTag(s): String/Number

    public static final String ENCODING = "UTF8"; // see note

    public static InputStream fromString(String str) {
        byte[] bytes = str.getBytes(ENCODING);
        return new ByteArrayInputStream(bytes);
    }

Note : List of supported encodings here




If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2012
[ home ]