Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.mysql.jdbc
Class StringUtils  view StringUtils download StringUtils.java

java.lang.Object
  extended bycom.mysql.jdbc.StringUtils

public class StringUtils
extends java.lang.Object

Various utility methods for converting to/from byte arrays in the platform encoding


Field Summary
private static byte[] allBytes
           
private static int BYTE_RANGE
           
private static char[] byteToChars
           
 
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
 

Field Detail

BYTE_RANGE

private static final int BYTE_RANGE
See Also:
Constant Field Values

allBytes

private static byte[] allBytes

byteToChars

private static char[] byteToChars
Constructor Detail

StringUtils

public StringUtils()
Method Detail

getBytes

public static final byte[] getBytes(java.lang.String s,
                                    java.lang.String encoding,
                                    java.lang.String serverEncoding,
                                    boolean parserKnowsUnicode)
                             throws java.io.UnsupportedEncodingException
Returns the byte[] representation of the given string using given encoding.


getBytes

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
Returns the byte[] representation of the given string (re)using the given charset converter, and the given encoding.


getBytes

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
DOCUMENT ME!


dumpAsHex

public static final void dumpAsHex(byte[] byteBuffer,
                                   int length)
Dumps the given bytes to STDOUT as a hex dump (up to length bytes).


toAsciiString

public static final java.lang.String toAsciiString(byte[] buffer)
Returns the bytes as an ASCII String.


toAsciiString

public static final java.lang.String toAsciiString(byte[] buffer,
                                                   int startPos,
                                                   int length)
Returns the bytes as an ASCII String.


escapeEasternUnicodeByteStream

public 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.


firstNonWsCharUc

public static char firstNonWsCharUc(java.lang.String searchIn)
Returns the first non whitespace char, converted to upper case


split

public static final java.util.List split(java.lang.String stringToSplit,
                                         java.lang.String delimitter,
                                         boolean trim)
Splits stringToSplit into a list, using the given delimitter


startsWithIgnoreCase

public 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. Shorthand for a String.regionMatch(...)


startsWithIgnoreCase

public 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(...)


startsWithIgnoreCaseAndWs

public 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