Java Doc for StringUtils.java in  » Database-JDBC-Connection-Pool » mysql-connector-java-5.1.3 » com » mysql » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » mysql connector java 5.1.3 » com.mysql.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.mysql.jdbc.StringUtils

StringUtils
public class StringUtils (Code)
Various utility methods for converting to/from byte arrays in the platform encoding
author:
   Mark Matthews


Field Summary
final static  intWILD_COMPARE_MATCH_NO_WILD
    
final static  intWILD_COMPARE_MATCH_WITH_WILD
    
final static  intWILD_COMPARE_NO_MATCH
    


Method Summary
public static  StringconsistentToString(BigDecimal decimal)
    
final public static  StringdumpAsHex(byte[] byteBuffer, int length)
     Dumps the given bytes to STDOUT as a hex dump (up to length bytes).
public static  byte[]escapeEasternUnicodeByteStream(byte[] origBytes, 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.
Parameters:
  origBytes - the original bytes in SJIS format
Parameters:
  origString - the string that had .getBytes() called on it
Parameters:
  offset - where to start converting from
Parameters:
  length - how many characters to convert.
public static  charfirstNonWsCharUc(String searchIn)
    
public static  charfirstNonWsCharUc(String searchIn, int startAt)
    
final public static  StringfixDecimalExponent(String dString)
    
final public static  byte[]getBytes(char[] c, SingleByteCharsetConverter converter, String encoding, String serverEncoding, boolean parserKnowsUnicode)
    
final public static  byte[]getBytes(char[] c, SingleByteCharsetConverter converter, String encoding, String serverEncoding, int offset, int length, boolean parserKnowsUnicode)
    
final public static  byte[]getBytes(char[] c, String encoding, String serverEncoding, boolean parserKnowsUnicode, ConnectionImpl conn)
    
final public static  byte[]getBytes(String s, SingleByteCharsetConverter converter, String encoding, String serverEncoding, boolean parserKnowsUnicode)
     Returns the byte[] representation of the given string (re)using the given charset converter, and the given encoding.
final public static  byte[]getBytes(String s, SingleByteCharsetConverter converter, String encoding, String serverEncoding, int offset, int length, boolean parserKnowsUnicode)
    
final public static  byte[]getBytes(String s, String encoding, String serverEncoding, boolean parserKnowsUnicode, ConnectionImpl conn)
     Returns the byte[] representation of the given string using given encoding.
final public static  byte[]getBytesWrapped(String s, char beginWrap, char endWrap, SingleByteCharsetConverter converter, String encoding, String serverEncoding, boolean parserKnowsUnicode)
    
public static  intgetInt(byte[] buf, int offset, int endPos)
    
public static  intgetInt(byte[] buf)
    
public static  longgetLong(byte[] buf)
    
public static  longgetLong(byte[] buf, int offset, int endpos)
    
public static  shortgetShort(byte[] buf)
    
public static  intindexOf(byte[] s, char c)
    
final public static  intindexOfIgnoreCase(int startingPosition, String searchIn, String searchFor)
    
final public static  intindexOfIgnoreCase(String searchIn, String searchFor)
    
public static  intindexOfIgnoreCaseRespectMarker(int startAt, String src, String target, String marker, String markerCloses, boolean allowBackslashEscapes)
    
public static  intindexOfIgnoreCaseRespectQuotes(int startAt, String src, String target, char quoteChar, boolean allowBackslashEscapes)
    
final public static  booleanisEmptyOrWhitespaceOnly(String str)
    
public static  booleanisNullOrEmpty(String toTest)
    
public static  intlastIndexOf(byte[] s, char c)
    
static  byte[]s2b(String s, ConnectionImpl conn)
    
final public static  Listsplit(String stringToSplit, String delimitter, boolean trim)
    
final public static  Listsplit(String stringToSplit, String delimiter, String markers, String markerCloses, boolean trim)
    
public static  booleanstartsWithIgnoreCase(String searchIn, int startAt, String searchFor)
    
public static  booleanstartsWithIgnoreCase(String searchIn, String searchFor)
     Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case.
public static  booleanstartsWithIgnoreCaseAndNonAlphaNumeric(String searchIn, String searchFor)
     Determines whether or not the sting 'searchIn' contains the string 'searchFor', disregarding case,leading whitespace and non-alphanumeric characters.
public static  booleanstartsWithIgnoreCaseAndWs(String searchIn, String searchFor)
    
public static  booleanstartsWithIgnoreCaseAndWs(String searchIn, String searchFor, int beginPos)
    
public static  StringstripComments(String src, String stringOpens, String stringCloses, boolean slashStarComments, boolean slashSlashComments, boolean hashComments, boolean dashDashComments)
    
public static  byte[]stripEnclosure(byte[] source, String prefix, String suffix)
    
final public static  StringtoAsciiString(byte[] buffer)
     Returns the bytes as an ASCII String.
final public static  StringtoAsciiString(byte[] buffer, int startPos, int length)
     Returns the bytes as an ASCII String.
public static  intwildCompare(String searchIn, String searchForWildcard)
    

Field Detail
WILD_COMPARE_MATCH_NO_WILD
final static int WILD_COMPARE_MATCH_NO_WILD(Code)



WILD_COMPARE_MATCH_WITH_WILD
final static int WILD_COMPARE_MATCH_WITH_WILD(Code)



WILD_COMPARE_NO_MATCH
final static int WILD_COMPARE_NO_MATCH(Code)





Method Detail
consistentToString
public static String consistentToString(BigDecimal decimal)(Code)
Takes care of the fact that Sun changed the output of BigDecimal.toString() between JDK-1.4 and JDK 5
Parameters:
  decimal - the big decimal to stringify a string representation of 'decimal'



dumpAsHex
final public static String dumpAsHex(byte[] byteBuffer, int length)(Code)
Dumps the given bytes to STDOUT as a hex dump (up to length bytes).
Parameters:
  byteBuffer - the data to print as hex
Parameters:
  length - the number of bytes to print ...



escapeEasternUnicodeByteStream
public static byte[] escapeEasternUnicodeByteStream(byte[] origBytes, String origString, int offset, int length)(Code)
Unfortunately, SJIS has 0x5c as a high byte in some of its double-byte characters, so we need to escape it.
Parameters:
  origBytes - the original bytes in SJIS format
Parameters:
  origString - the string that had .getBytes() called on it
Parameters:
  offset - where to start converting from
Parameters:
  length - how many characters to convert. byte[] with 0x5c escaped



firstNonWsCharUc
public static char firstNonWsCharUc(String searchIn)(Code)
Returns the first non whitespace char, converted to upper case
Parameters:
  searchIn - the string to search in the first non-whitespace character, upper cased.



firstNonWsCharUc
public static char firstNonWsCharUc(String searchIn, int startAt)(Code)



fixDecimalExponent
final public static String fixDecimalExponent(String dString)(Code)
Adds '+' to decimal numbers that are positive (MySQL doesn't understand them otherwise
Parameters:
  dString - The value as a string String the string with a '+' added (if needed)



getBytes
final public static byte[] getBytes(char[] c, SingleByteCharsetConverter converter, String encoding, String serverEncoding, boolean parserKnowsUnicode) throws SQLException(Code)



getBytes
final public static byte[] getBytes(char[] c, SingleByteCharsetConverter converter, String encoding, String serverEncoding, int offset, int length, boolean parserKnowsUnicode) throws SQLException(Code)



getBytes
final public static byte[] getBytes(char[] c, String encoding, String serverEncoding, boolean parserKnowsUnicode, ConnectionImpl conn) throws SQLException(Code)



getBytes
final public static byte[] getBytes(String s, SingleByteCharsetConverter converter, String encoding, String serverEncoding, boolean parserKnowsUnicode) throws SQLException(Code)
Returns the byte[] representation of the given string (re)using the given charset converter, and the given encoding.
Parameters:
  s - the string to convert
Parameters:
  converter - the converter to reuse
Parameters:
  encoding - the character encoding to use
Parameters:
  serverEncoding - DOCUMENT ME!
Parameters:
  parserKnowsUnicode - DOCUMENT ME! byte[] representation of the string
throws:
  SQLException - if an encoding unsupported by the JVM is supplied.



getBytes
final public static byte[] getBytes(String s, SingleByteCharsetConverter converter, String encoding, String serverEncoding, int offset, int length, boolean parserKnowsUnicode) throws SQLException(Code)
DOCUMENT ME!
Parameters:
  s - DOCUMENT ME!
Parameters:
  converter - DOCUMENT ME!
Parameters:
  encoding - DOCUMENT ME!
Parameters:
  serverEncoding - DOCUMENT ME!
Parameters:
  offset - DOCUMENT ME!
Parameters:
  length - DOCUMENT ME!
Parameters:
  parserKnowsUnicode - DOCUMENT ME! DOCUMENT ME!
throws:
  SQLException - DOCUMENT ME!



getBytes
final public static byte[] getBytes(String s, String encoding, String serverEncoding, boolean parserKnowsUnicode, ConnectionImpl conn) throws SQLException(Code)
Returns the byte[] representation of the given string using given encoding.
Parameters:
  s - the string to convert
Parameters:
  encoding - the character encoding to use
Parameters:
  parserKnowsUnicode - DOCUMENT ME! byte[] representation of the string
throws:
  SQLException - if an encoding unsupported by the JVM is supplied.



getBytesWrapped
final public static byte[] getBytesWrapped(String s, char beginWrap, char endWrap, SingleByteCharsetConverter converter, String encoding, String serverEncoding, boolean parserKnowsUnicode) throws SQLException(Code)



getInt
public static int getInt(byte[] buf, int offset, int endPos) throws NumberFormatException(Code)



getInt
public static int getInt(byte[] buf) throws NumberFormatException(Code)



getLong
public static long getLong(byte[] buf) throws NumberFormatException(Code)



getLong
public static long getLong(byte[] buf, int offset, int endpos) throws NumberFormatException(Code)



getShort
public static short getShort(byte[] buf) throws NumberFormatException(Code)



indexOf
public static int indexOf(byte[] s, char c)(Code)



indexOfIgnoreCase
final public static int indexOfIgnoreCase(int startingPosition, String searchIn, String searchFor)(Code)



indexOfIgnoreCase
final public static int indexOfIgnoreCase(String searchIn, String searchFor)(Code)
DOCUMENT ME!
Parameters:
  searchIn - DOCUMENT ME!
Parameters:
  searchFor - DOCUMENT ME! DOCUMENT ME!



indexOfIgnoreCaseRespectMarker
public static int indexOfIgnoreCaseRespectMarker(int startAt, String src, String target, String marker, String markerCloses, boolean allowBackslashEscapes)(Code)



indexOfIgnoreCaseRespectQuotes
public static int indexOfIgnoreCaseRespectQuotes(int startAt, String src, String target, char quoteChar, boolean allowBackslashEscapes)(Code)



isEmptyOrWhitespaceOnly
final public static boolean isEmptyOrWhitespaceOnly(String str)(Code)



isNullOrEmpty
public static boolean isNullOrEmpty(String toTest)(Code)



lastIndexOf
public static int lastIndexOf(byte[] s, char c)(Code)



s2b
static byte[] s2b(String s, ConnectionImpl conn) throws SQLException(Code)



split
final public static List split(String stringToSplit, String delimitter, boolean trim)(Code)
Splits stringToSplit into a list, using the given delimitter
Parameters:
  stringToSplit - the string to split
Parameters:
  delimitter - the string to split on
Parameters:
  trim - should the split strings be whitespace trimmed? the list of strings, split by delimitter
throws:
  IllegalArgumentException - DOCUMENT ME!



split
final public static List split(String stringToSplit, String delimiter, String markers, String markerCloses, boolean trim)(Code)
Splits stringToSplit into a list, using the given delimitter
Parameters:
  stringToSplit - the string to split
Parameters:
  delimitter - the string to split on
Parameters:
  trim - should the split strings be whitespace trimmed? the list of strings, split by delimiter
throws:
  IllegalArgumentException - DOCUMENT ME!



startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String searchIn, int startAt, String searchFor)(Code)
Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case starting at 'startAt' Shorthand for a String.regionMatch(...)
Parameters:
  searchIn - the string to search in
Parameters:
  startAt - the position to start at
Parameters:
  searchFor - the string to search for whether searchIn starts with searchFor, ignoring case



startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String searchIn, String searchFor)(Code)
Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case. Shorthand for a String.regionMatch(...)
Parameters:
  searchIn - the string to search in
Parameters:
  searchFor - the string to search for whether searchIn starts with searchFor, ignoring case



startsWithIgnoreCaseAndNonAlphaNumeric
public static boolean startsWithIgnoreCaseAndNonAlphaNumeric(String searchIn, String searchFor)(Code)
Determines whether or not the sting 'searchIn' contains the string 'searchFor', disregarding case,leading whitespace and non-alphanumeric characters.
Parameters:
  searchIn - the string to search in
Parameters:
  searchFor - the string to search for true if the string starts with 'searchFor' ignoring whitespace



startsWithIgnoreCaseAndWs
public static boolean startsWithIgnoreCaseAndWs(String searchIn, String searchFor)(Code)
Determines whether or not the sting 'searchIn' contains the string 'searchFor', disregarding case and leading whitespace
Parameters:
  searchIn - the string to search in
Parameters:
  searchFor - the string to search for true if the string starts with 'searchFor' ignoring whitespace



startsWithIgnoreCaseAndWs
public static boolean startsWithIgnoreCaseAndWs(String searchIn, String searchFor, int beginPos)(Code)
Determines whether or not the sting 'searchIn' contains the string 'searchFor', disregarding case and leading whitespace
Parameters:
  searchIn - the string to search in
Parameters:
  searchFor - the string to search for
Parameters:
  beginPos - where to start searching true if the string starts with 'searchFor' ignoring whitespace



stripComments
public static String stripComments(String src, String stringOpens, String stringCloses, boolean slashStarComments, boolean slashSlashComments, boolean hashComments, boolean dashDashComments)(Code)
Returns the given string, with comments removed
Parameters:
  src - the source string
Parameters:
  stringOpens - characters which delimit the "open" of a string
Parameters:
  stringCloses - characters which delimit the "close" of a string, incounterpart order to stringOpens
Parameters:
  slashStarComments - strip slash-star type "C" style comments
Parameters:
  slashSlashComments - strip slash-slash C++ style comments to end-of-line
Parameters:
  hashComments - strip #-style comments to end-of-line
Parameters:
  dashDashComments - strip "--" style comments to end-of-line the input string with all comment-delimited data removed



stripEnclosure
public static byte[] stripEnclosure(byte[] source, String prefix, String suffix)(Code)

Parameters:
  bytesToStrip -
Parameters:
  prefix -
Parameters:
  suffix -



toAsciiString
final public static String toAsciiString(byte[] buffer)(Code)
Returns the bytes as an ASCII String.
Parameters:
  buffer - the bytes representing the string The ASCII String.



toAsciiString
final public static String toAsciiString(byte[] buffer, int startPos, int length)(Code)
Returns the bytes as an ASCII String.
Parameters:
  buffer - the bytes to convert
Parameters:
  startPos - the position to start converting
Parameters:
  length - the length of the string to convert the ASCII string



wildCompare
public static int wildCompare(String searchIn, String searchForWildcard)(Code)
Compares searchIn against searchForWildcard with wildcards (heavily borrowed from strings/ctype-simple.c in the server sources)
Parameters:
  searchIn - the string to search in
Parameters:
  searchForWildcard - the string to search for, using the 'standard' SQL wildcardchars of '%' and '_' WILD_COMPARE_MATCH_NO_WILD if matched, WILD_COMPARE_NO_MATCH ifnot matched with wildcard, WILD_COMPARE_MATCH_WITH_WILD ifmatched with wildcard



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.