Package org.apache.derby.client.net
Class EbcdicCcsidManager
- java.lang.Object
-
- org.apache.derby.client.net.CcsidManager
-
- org.apache.derby.client.net.EbcdicCcsidManager
-
class EbcdicCcsidManager extends CcsidManager
A concrete implementation of a CcsidMgr used to convert between Java UCS2 and Ebcdic as needed to handle character DDM Parameters. This implementation only supports converting from the ASCII invariant of UNICODE to Ebcdic. This should be fine since this class is intended for converting DDM Parameter data only.
-
-
Field Summary
Fields Modifier and Type Field Description private static int[]conversionArrayToEbcdicprivate static int[]conversionArrayToUCS2-
Fields inherited from class org.apache.derby.client.net.CcsidManager
dot_, numToCharRepresentation_, numToSnaRequiredCrrtknChar_, space_, UTF8_CCSID
-
-
Constructor Summary
Constructors Constructor Description EbcdicCcsidManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]convertFromJavaString(java.lang.String sourceString, Agent agent)(package private) java.lang.StringconvertToJavaString(byte[] sourceBytes, int offset, int numToConvert)booleanencode(java.nio.CharBuffer src, java.nio.ByteBuffer dest, Agent agent)Encode the contents of aCharBufferinto aByteBuffer.voidstartEncoding()Initialize this instance for encoding a new string.
-
-
-
Method Detail
-
convertFromJavaString
public byte[] convertFromJavaString(java.lang.String sourceString, Agent agent) throws SqlException- Specified by:
convertFromJavaStringin classCcsidManager- Throws:
SqlException
-
startEncoding
public void startEncoding()
Description copied from class:CcsidManagerInitialize this instance for encoding a new string. This method resets any internal state that may be left after earlier calls toCcsidManager.encode(java.nio.CharBuffer, java.nio.ByteBuffer, org.apache.derby.client.am.Agent)on this instance. For example, it may reset the internaljava.nio.charset.CharsetEncoder, if the implementation uses one to do the encoding.- Specified by:
startEncodingin classCcsidManager
-
encode
public boolean encode(java.nio.CharBuffer src, java.nio.ByteBuffer dest, Agent agent) throws SqlExceptionDescription copied from class:CcsidManagerEncode the contents of aCharBufferinto aByteBuffer. The method will returntrueif 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 returnfalse. 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:
encodein classCcsidManager- Parameters:
src- buffer holding the characters to encodedest- buffer receiving the encoded bytesagent- where to report errors- Returns:
trueif all characters were encoded,falseif 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
-
convertToJavaString
java.lang.String convertToJavaString(byte[] sourceBytes, int offset, int numToConvert)- Specified by:
convertToJavaStringin classCcsidManager
-
-