public final class TextUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CHARSET
Default encoding used.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
stringToByteArray(String content,
String charset)
Converts a string into a byte array using the specified encoding.
|
static InputStream |
toInputStream(String content)
Convert a string into an input stream.
|
static InputStream |
toInputStream(String content,
String encoding)
Convert a string into an input stream.
|
public static final String DEFAULT_CHARSET
public static InputStream toInputStream(String content)
content
- the stringpublic static InputStream toInputStream(String content, String encoding) throws UnsupportedEncodingException
content
- the stringencoding
- the encoding to use when converting the string to a streamUnsupportedEncodingException
- if the encoding is not supportedpublic static byte[] stringToByteArray(String content, String charset)
charset
- the name of a supported charsetcontent
- the string to convertCopyright © 2002–2016 Gargoyle Software Inc.. All rights reserved.