org.apache.derby.client.net
Class Utf8CcsidManager

java.lang.Object
  extended by org.apache.derby.client.net.CcsidManager
      extended by org.apache.derby.client.net.Utf8CcsidManager

public class Utf8CcsidManager
extends CcsidManager


Field Summary
private  java.nio.charset.CharsetEncoder encoder
           
private static java.lang.String UTF8
           
private static java.nio.charset.Charset UTF8_CHARSET
           
 
Fields inherited from class org.apache.derby.client.net.CcsidManager
dot_, numToCharRepresentation_, numToSnaRequiredCrrtknChar_, space_, UTF8_CCSID
 
Constructor Summary
Utf8CcsidManager()
           
 
Method Summary
 byte[] convertFromJavaString(java.lang.String sourceString, Agent agent)
           
 java.lang.String convertToJavaString(byte[] sourceBytes, int offset, int numToConvert)
          Offset and numToConvert are given in terms of bytes!
 boolean encode(java.nio.CharBuffer src, java.nio.ByteBuffer dest, Agent agent)
          Encode the contents of a CharBuffer into a ByteBuffer.
 void startEncoding()
          Initialize this instance for encoding a new string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8

private static final java.lang.String UTF8
See Also:
Constant Field Values

UTF8_CHARSET

private static final java.nio.charset.Charset UTF8_CHARSET

encoder

private final java.nio.charset.CharsetEncoder encoder
Constructor Detail

Utf8CcsidManager

public Utf8CcsidManager()
Method Detail

convertFromJavaString

public byte[] convertFromJavaString(java.lang.String sourceString,
                                    Agent agent)
                             throws SqlException
Specified by:
convertFromJavaString in class CcsidManager
Throws:
SqlException

convertToJavaString

public java.lang.String convertToJavaString(byte[] sourceBytes,
                                            int offset,
                                            int numToConvert)
Offset and numToConvert are given in terms of bytes! Not characters!

Specified by:
convertToJavaString in class CcsidManager

startEncoding

public void startEncoding()
Description copied from class: CcsidManager
Initialize this instance for encoding a new string. This method resets any internal state that may be left after earlier calls to CcsidManager.encode(java.nio.CharBuffer, java.nio.ByteBuffer, org.apache.derby.client.am.Agent) on this instance. For example, it may reset the internal java.nio.charset.CharsetEncoder, if the implementation uses one to do the encoding.

Specified by:
startEncoding in class CcsidManager

encode

public boolean encode(java.nio.CharBuffer src,
                      java.nio.ByteBuffer dest,
                      Agent agent)
               throws SqlException
Description copied from class: CcsidManager
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.

Specified by:
encode in class CcsidManager
Parameters:
src - buffer holding the characters to encode
dest - buffer receiving the encoded bytes
agent - where to report errors
Returns:
true if all characters were encoded, false if the destination buffer is full and there still are more characters to encode
Throws:
SqlException - if the characters cannot be encoded using this CCSID manager's character encoding

Built on Wed 2013-06-12 15:21:56+0000, from revision ???

Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.