Top Fields Constructors Methods
org.apache.derby.client.net

public Class Utf8CcsidManager

extends CcsidManager
Class Inheritance
Imports
java.nio.ByteBuffer, .CharBuffer, java.nio.charset.CharacterCodingException, .Charset, .CharsetEncoder, .CoderResult, org.apache.derby.client.am.Agent, .ClientMessageId, .SqlException, org.apache.derby.shared.common.reference.SQLState

Field Summary

Modifier and TypeField and Description
private final CharsetEncoder
private static final String
private static final Charset
Inherited from org.apache.derby.client.net.CcsidManager:
dot_numToCharRepresentation_numToSnaRequiredCrrtknChar_space_UTF8_CCSID

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public byte[]
public String
convertToJavaString(byte[] sourceBytes, int offset, int numToConvert)

Implements abstract org.apache.derby.client.net.CcsidManager.convertToJavaString.

Offset and numToConvert are given in terms of bytes!
public boolean
encode(CharBuffer
buffer holding the characters to encode
src
,
ByteBuffer
buffer receiving the encoded bytes
dest
,
Agent
where to report errors
agent
)

Implements abstract org.apache.derby.client.net.CcsidManager.encode.

Encode the contents of a CharBuffer into a ByteBuffer.
public void
startEncoding()

Implements abstract org.apache.derby.client.net.CcsidManager.startEncoding.

Initialize this instance for encoding a new string.

Field Detail

encoderback to summary
private final CharsetEncoder encoder
UTF8back to summary
private static final String UTF8
UTF8_CHARSETback to summary
private static final Charset UTF8_CHARSET

Constructor Detail

Utf8CcsidManagerback to summary
public Utf8CcsidManager()

Method Detail

convertFromJavaStringback to summary
public byte[] convertFromJavaString(String sourceString, Agent agent) throws SqlException

Implements abstract org.apache.derby.client.net.CcsidManager.convertFromJavaString.

convertToJavaStringback to summary
public String convertToJavaString(byte[] sourceBytes, int offset, int numToConvert)

Implements abstract org.apache.derby.client.net.CcsidManager.convertToJavaString.

Offset and numToConvert are given in terms of bytes! Not characters!

encodeback to summary
public boolean encode(CharBuffer src, ByteBuffer dest, Agent agent) throws SqlException

Implements abstract org.apache.derby.client.net.CcsidManager.encode.

Doc from org.apache.derby.client.net.CcsidManager.encode.

Encode the contents of a CharBuffer into a ByteBuffer. The method will return true if all the characters were encoded and copied to the destination. If the receiving byte buffer is too small to hold the entire encoded representation of the character buffer, the method will return false. The caller should then allocate a larger byte buffer, copy the contents from the old byte buffer to the new one, and then call this method again to get the remaining characters encoded.

Parameters
src:CharBuffer

buffer holding the characters to encode

dest:ByteBuffer

buffer receiving the encoded bytes

agent:Agent

where to report errors

Returns:boolean

true if all characters were encoded, false if the destination buffer is full and there still are more characters to encode

Exceptions
SqlException:
if the characters cannot be encoded using this CCSID manager's character encoding
startEncodingback to summary
public void startEncoding()

Implements abstract org.apache.derby.client.net.CcsidManager.startEncoding.

Doc from org.apache.derby.client.net.CcsidManager.startEncoding.

Initialize this instance for encoding a new string. This method resets any internal state that may be left after earlier calls to encode on this instance. For example, it may reset the internal java.nio.charset.CharsetEncoder, if the implementation uses one to do the encoding.