Package com.sun.corba.ee.impl.encoding
Class CodeSetConversion
java.lang.Object
com.sun.corba.ee.impl.encoding.CodeSetConversion
Collection of classes, interfaces, and factory methods for
CORBA code set conversion.
This is mainly used to shield other code from the sun.io
converters which might change, as well as provide some basic
translation from conversion to CORBA error exceptions. Some
extra work is required here to facilitate the way CORBA
says it uses UTF-16 as of the 00-11-03 spec.
REVISIT - Since the nio.Charset and nio.Charset.Encoder/Decoder
use NIO ByteBuffer and NIO CharBuffer, the interaction
and interface between this class and the CDR streams
should be looked at more closely for optimizations to
avoid unnecessary copying of data between char[] &
CharBuffer and byte[] & ByteBuffer, especially
DirectByteBuffers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Abstraction for byte to char conversion.private static class
static class
Abstraction for char to byte conversion.private class
Implementation of BTCConverter which uses a sun.io.ByteToCharConverter for the real work.private class
Implementation of CTBConverter which uses a nio.Charset.CharsetEncoder to do the real work.private class
Special converter for UTF16 since it's required to optionally support a byte order marker while the internal Java converters either require it or require that it isn't there.private class
Special UTF16 converter which can either always write a BOM or use a specified byte order without one. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CodeSetCache
private static final int
private static final OMGSystemException
private static final ORBUtilSystemException
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBTCConverter
(OSFCodeSetRegistry.Entry codeset) BTCConverter factory for single byte or variable width encodings.getBTCConverter
(OSFCodeSetRegistry.Entry codeset, ByteOrder defaultByteOrder) BTCConverter factory for fixed width multibyte encodings.getCTBConverter
(OSFCodeSetRegistry.Entry codeset) CTB converter factory for single byte or variable length encodings.(package private) CodeSetConversion.CTBConverter
getCTBConverter
(OSFCodeSetRegistry.Entry codeset, boolean littleEndian, boolean useByteOrderMarkers) CTB converter factory for multibyte (mainly fixed) encodings.static CodeSetConversion
impl()
CodeSetConversion is a singleton, and this is the access point.negotiate
(CodeSetComponentInfo client, CodeSetComponentInfo server) Perform the code set negotiation algorithm and come up with the two encodings to use.private int
selectEncoding
(CodeSetComponentInfo.CodeSetComponent client, CodeSetComponentInfo.CodeSetComponent server) Follows the code set negotiation algorithm in CORBA formal 99-10-07 13.7.2.
-
Field Details
-
wrapper
-
omgWrapper
-
FALLBACK_CODESET
private static final int FALLBACK_CODESET- See Also:
-
cache
-
cacheBTCC
-
cacheCTBC
-
-
Constructor Details
-
CodeSetConversion
private CodeSetConversion()
-
-
Method Details
-
getCTBConverter
CTB converter factory for single byte or variable length encodings.- Parameters:
codeset
- Codeset to get converter for- Returns:
- Char-to-Byte Converter for codeset
-
getCTBConverter
CodeSetConversion.CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset, boolean littleEndian, boolean useByteOrderMarkers) CTB converter factory for multibyte (mainly fixed) encodings. Because of the awkwardness with byte order markers and the possibility of using UCS-2, you must specify both the endianness of the stream as well as whether or not to use byte order markers if applicable. UCS-2 has no byte order markers. UTF-16 has optional markers. If you select useByteOrderMarkers, there is no guarantee that the encoding will use the endianness specified. -
getBTCConverter
BTCConverter factory for single byte or variable width encodings.- Parameters:
codeset
- Codeset to get converter for- Returns:
- new Byte-to-Char Converter
-
getBTCConverter
public CodeSetConversion.BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset, ByteOrder defaultByteOrder) BTCConverter factory for fixed width multibyte encodings.- Parameters:
codeset
- Codeset to get converter fordefaultByteOrder
- Order of bytes in the codeset- Returns:
- Converter for a codeset
-
selectEncoding
private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client, CodeSetComponentInfo.CodeSetComponent server) Follows the code set negotiation algorithm in CORBA formal 99-10-07 13.7.2. Returns the proper negotiated OSF character encoding number or CodeSetConversion.FALLBACK_CODESET. -
negotiate
public CodeSetComponentInfo.CodeSetContext negotiate(CodeSetComponentInfo client, CodeSetComponentInfo server) Perform the code set negotiation algorithm and come up with the two encodings to use.- Parameters:
client
- Info from the clientserver
- Info from the server- Returns:
- Resulted negotiated encoding context
-
impl
CodeSetConversion is a singleton, and this is the access point.- Returns:
- A holder for
CodeSetConversion
-