Class TextUtils
- java.lang.Object
-
- com.gargoylesoftware.htmlunit.util.TextUtils
-
public final class TextUtils extends java.lang.ObjectUtility methods relating to text.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]stringToByteArray(java.lang.String content, java.nio.charset.Charset charset)Converts a string into a byte array using the specified encoding.static java.io.InputStreamtoInputStream(java.lang.String content)Convert a string into an input stream.static java.io.InputStreamtoInputStream(java.lang.String content, java.nio.charset.Charset charset)Convert a string into an input stream.
-
-
-
Method Detail
-
toInputStream
public static java.io.InputStream toInputStream(java.lang.String content)
Convert a string into an input stream.- Parameters:
content- the string- Returns:
- the resulting input stream
-
toInputStream
public static java.io.InputStream toInputStream(java.lang.String content, java.nio.charset.Charset charset)Convert a string into an input stream.- Parameters:
content- the stringcharset- the encoding to use when converting the string to a stream- Returns:
- the resulting input stream
-
stringToByteArray
public static byte[] stringToByteArray(java.lang.String content, java.nio.charset.Charset charset)Converts a string into a byte array using the specified encoding.- Parameters:
charset- the charsetcontent- the string to convert- Returns:
- the String as a byte[]; if the specified encoding is not supported an empty byte[] will be returned
-
-