| java.lang.Object com.gargoylesoftware.htmlunit.TextUtil
TextUtil | final public class TextUtil (Code) | | Utility methods relating to text.
version: $Revision: 2132 $ author: Mike Bowler author: Brad Clarke author: Ahmed Ashour |
Method Summary | |
public static boolean | startsWithIgnoreCase(String stringToCheck, String prefix) Return true if the string starts with the specified prefix, irrespective of case. | public static byte[] | stringToByteArray(String content) Convert a string into a byte array using a default encoding
TextUtil.DEFAULT_CHARSET .
Parameters: content - The string to convert, assumed to be TextUtil.DEFAULT_CHARSET encoded The String as a byte[]. | public static byte[] | stringToByteArray(String content, String charset) Convert a string into a byte array using the given encoding.
Parameters: charset - The name of a supported charset Parameters: content - The string to convert The String as a byte[]. | public static InputStream | toInputStream(String content) Convert a string into an input stream. | public static InputStream | toInputStream(String content, String encoding) Convert a string into an input stream.
Parameters: content - The string Parameters: encoding - The encoding to use when converting the string to a stream. |
DEFAULT_CHARSET | final public static String DEFAULT_CHARSET(Code) | | Default encoding used.
|
startsWithIgnoreCase | public static boolean startsWithIgnoreCase(String stringToCheck, String prefix)(Code) | | Return true if the string starts with the specified prefix, irrespective of case.
Parameters: stringToCheck - The string to check Parameters: prefix - The prefix true if the string starts with the prefix. |
stringToByteArray | public static byte[] stringToByteArray(String content)(Code) | | Convert a string into a byte array using a default encoding
TextUtil.DEFAULT_CHARSET .
Parameters: content - The string to convert, assumed to be TextUtil.DEFAULT_CHARSET encoded The String as a byte[]. If the default encoding is not supported an empty byte[] will be returned. |
stringToByteArray | public static byte[] stringToByteArray(String content, String charset)(Code) | | Convert a string into a byte array using the given encoding.
Parameters: charset - The name of a supported charset Parameters: content - The string to convert The String as a byte[]. If the specified encoding is not supported an empty byte[] will be returned. |
toInputStream | public static InputStream toInputStream(String content)(Code) | | Convert a string into an input stream.
Parameters: content - The string The resulting input stream. |
|
|