|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mysql.jdbc.SingleByteCharsetConverter
Converter for char[]->byte[] and byte[]->char[] for single-byte character sets. Much faster (5-6x) than the built-in solution that ships with the JVM, even with JDK-1.4.x and NewIo.
| Method Summary | |
static SingleByteCharsetConverter |
getInstance(java.lang.String encodingName)
Get a converter for the given encoding name |
static SingleByteCharsetConverter |
initCharset(java.lang.String javaEncodingName)
Initialize the shared instance of a converter for the given character encoding. |
byte[] |
toBytes(java.lang.String s)
Convert the given string to an array of bytes. |
byte[] |
toBytes(java.lang.String s,
int offset,
int length)
Convert the given string to an array of bytes. |
java.lang.String |
toString(byte[] buffer)
Convert the byte buffer to a string using this instance's character encoding. |
java.lang.String |
toString(byte[] buffer,
int startPos,
int length)
Convert the byte buffer from startPos to a length of length to a string using this instance's character encoding. |
static java.lang.String |
toStringDefaultEncoding(byte[] buffer,
int startPos,
int length)
Convert the byte buffer from startPos to a length of length to a string using the default platform encoding. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static SingleByteCharsetConverter getInstance(java.lang.String encodingName)
throws java.io.UnsupportedEncodingException
encodingName - the Java character encoding name
java.io.UnsupportedEncodingException - if the character encoding is not
supported
public static SingleByteCharsetConverter initCharset(java.lang.String javaEncodingName)
throws java.io.UnsupportedEncodingException
javaEncodingName - the Java name for the character set to
initialize
java.io.UnsupportedEncodingException - if the character encoding is not
supported
public static java.lang.String toStringDefaultEncoding(byte[] buffer,
int startPos,
int length)
buffer - the bytes to convertstartPos - the index to start atlength - the number of bytes to convert
public final byte[] toBytes(java.lang.String s)
s - the String to convert
public final byte[] toBytes(java.lang.String s,
int offset,
int length)
s - the String to convertoffset - the offset to start atlength - length (max) to convert
public final java.lang.String toString(byte[] buffer)
buffer - the bytes to convert to a String
public final java.lang.String toString(byte[] buffer,
int startPos,
int length)
buffer - the bytes to convertstartPos - the index to start atlength - the number of bytes to convert
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||