|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mysql.jdbc.SingleByteCharsetConverter
public class 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,
Connection conn)
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(char[] c)
|
byte[] |
toBytes(char[] chars,
int offset,
int length)
|
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. |
byte[] |
toBytesWrapped(char[] c,
char beginWrap,
char endWrap)
|
byte[] |
toBytesWrapped(java.lang.String s,
char beginWrap,
char endWrap)
|
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, Connection conn) throws java.io.UnsupportedEncodingException, java.sql.SQLException
encodingName
- the Java character encoding name
java.io.UnsupportedEncodingException
- if the character encoding is not supported
java.sql.SQLException
public static SingleByteCharsetConverter initCharset(java.lang.String javaEncodingName) throws java.io.UnsupportedEncodingException, java.sql.SQLException
javaEncodingName
- the Java name for the character set to initialize
java.io.UnsupportedEncodingException
- if the character encoding is not supported
java.sql.SQLException
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(char[] c)
public final byte[] toBytesWrapped(char[] c, char beginWrap, char endWrap)
public final byte[] toBytes(char[] chars, int offset, int length)
public final byte[] toBytes(java.lang.String s)
s
- the String to convert
public final byte[] toBytesWrapped(java.lang.String s, char beginWrap, char endWrap)
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 |