|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mysql.jdbc.StringUtils
Various utility methods for converting to/from byte arrays in the platform encoding
Constructor Summary | |
StringUtils()
|
Method Summary | |
static void |
dumpAsHex(byte[] byteBuffer,
int length)
Dumps the given bytes to STDOUT as a hex dump (up to length bytes). |
static byte[] |
escapeEasternUnicodeByteStream(byte[] origBytes,
java.lang.String origString,
int offset,
int length)
Unfortunately, SJIS has 0x5c as a high byte in some of its double-byte characters, so we need to escape it. |
static char |
firstNonWsCharUc(java.lang.String searchIn)
Returns the first non whitespace char, converted to upper case |
static byte[] |
getBytes(java.lang.String s,
SingleByteCharsetConverter converter,
java.lang.String encoding,
java.lang.String serverEncoding,
boolean parserKnowsUnicode)
Returns the byte[] representation of the given string (re)using the given charset converter, and the given encoding. |
static byte[] |
getBytes(java.lang.String s,
SingleByteCharsetConverter converter,
java.lang.String encoding,
java.lang.String serverEncoding,
int offset,
int length,
boolean parserKnowsUnicode)
DOCUMENT ME! |
static byte[] |
getBytes(java.lang.String s,
java.lang.String encoding,
java.lang.String serverEncoding,
boolean parserKnowsUnicode)
Returns the byte[] representation of the given string using given encoding. |
static java.util.List |
split(java.lang.String stringToSplit,
java.lang.String delimitter,
boolean trim)
Splits stringToSplit into a list, using the given delimitter |
static boolean |
startsWithIgnoreCase(java.lang.String searchIn,
int startAt,
java.lang.String searchFor)
Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case starting at 'startAt' Shorthand for a String.regionMatch(...) |
static boolean |
startsWithIgnoreCase(java.lang.String searchIn,
java.lang.String searchFor)
Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case. |
static boolean |
startsWithIgnoreCaseAndWs(java.lang.String searchIn,
java.lang.String searchFor)
Determines whether or not the sting 'searchIn' contains the string 'searchFor', di-regarding case and leading whitespace |
static java.lang.String |
toAsciiString(byte[] buffer)
Returns the bytes as an ASCII String. |
static java.lang.String |
toAsciiString(byte[] buffer,
int startPos,
int length)
Returns the bytes as an ASCII String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StringUtils()
Method Detail |
public static final byte[] getBytes(java.lang.String s, java.lang.String encoding, java.lang.String serverEncoding, boolean parserKnowsUnicode) throws java.io.UnsupportedEncodingException
s
- the string to convertencoding
- the character encoding to useserverEncoding
- DOCUMENT ME!parserKnowsUnicode
- DOCUMENT ME!
java.io.UnsupportedEncodingException
- if an encoding unsupported by the
JVM is supplied.public static final byte[] getBytes(java.lang.String s, SingleByteCharsetConverter converter, java.lang.String encoding, java.lang.String serverEncoding, boolean parserKnowsUnicode) throws java.io.UnsupportedEncodingException
s
- the string to convertconverter
- the converter to reuseencoding
- the character encoding to useserverEncoding
- DOCUMENT ME!parserKnowsUnicode
- DOCUMENT ME!
java.io.UnsupportedEncodingException
- if an encoding unsupported by the
JVM is supplied.public static final byte[] getBytes(java.lang.String s, SingleByteCharsetConverter converter, java.lang.String encoding, java.lang.String serverEncoding, int offset, int length, boolean parserKnowsUnicode) throws java.io.UnsupportedEncodingException
s
- DOCUMENT ME!converter
- DOCUMENT ME!encoding
- DOCUMENT ME!serverEncoding
- DOCUMENT ME!offset
- DOCUMENT ME!length
- DOCUMENT ME!parserKnowsUnicode
- DOCUMENT ME!
java.io.UnsupportedEncodingException
- DOCUMENT ME!public static final void dumpAsHex(byte[] byteBuffer, int length)
byteBuffer
- the data to print as hexlength
- the number of bytes to printpublic static final java.lang.String toAsciiString(byte[] buffer)
buffer
- the bytes representing the string
public static final java.lang.String toAsciiString(byte[] buffer, int startPos, int length)
buffer
- the bytes to convertstartPos
- the position to start convertinglength
- the length of the string to convert
public static byte[] escapeEasternUnicodeByteStream(byte[] origBytes, java.lang.String origString, int offset, int length)
origBytes
- the original bytes in SJIS formatorigString
- the string that had .getBytes() called on itoffset
- where to start converting fromlength
- how many characters to convert.
public static char firstNonWsCharUc(java.lang.String searchIn)
searchIn
- the string to search in
public static final java.util.List split(java.lang.String stringToSplit, java.lang.String delimitter, boolean trim)
stringToSplit
- the string to splitdelimitter
- the string to split ontrim
- should the split strings be whitespace trimmed?
java.lang.IllegalArgumentException
- DOCUMENT ME!public static boolean startsWithIgnoreCase(java.lang.String searchIn, java.lang.String searchFor)
searchIn
- the string to search insearchFor
- the string to search for
public static boolean startsWithIgnoreCase(java.lang.String searchIn, int startAt, java.lang.String searchFor)
searchIn
- the string to search instartAt
- the position to start atsearchFor
- the string to search for
public static boolean startsWithIgnoreCaseAndWs(java.lang.String searchIn, java.lang.String searchFor)
searchIn
- the string to search insearchFor
- the string to search for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |