public class SingleByteCharsetConverter
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static SingleByteCharsetConverter getInstance(java.lang.String encodingName, Connection conn) throws java.io.UnsupportedEncodingException, java.sql.SQLException
encodingName - the Java character encoding nameconn - java.io.UnsupportedEncodingException - if the character encoding is not supportedjava.sql.SQLExceptionpublic static SingleByteCharsetConverter initCharset(java.lang.String javaEncodingName) throws java.io.UnsupportedEncodingException, java.sql.SQLException
javaEncodingName - the Java name for the character set to initializejava.io.UnsupportedEncodingException - if the character encoding is not supportedjava.sql.SQLExceptionpublic 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 convertpublic 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 convertpublic 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 convertpublic final java.lang.String toString(byte[] buffer)
buffer - the bytes to convert to a Stringpublic 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