org.openorb.iiop
Class  CodeSet
java.lang.Object
  |
  +--org.openorb.iiop.CodeSet
- public final class CodeSet- extends java.lang.Object
This class represents an entry in the codeset database.
 The primary key ist the codeset id. Attached to this key 
 are information like name, canonical name, description, array of,
 charset ids number of bytes, maximum number of bytes, and a flag
 whether this is a server side or a client side entry.
- Author: 
- Michael Rumpf
| Constructor Summary | 
| CodeSet(java.lang.String description,
        int id,
        short[] charsets,
        int maxSize,
        java.lang.String canonical,
        java.lang.String name,
        int alignment,
        boolean server)Constructor.
 | 
 
| Method Summary | 
| static boolean | compatible(CodeSet entryA,
           CodeSet entryB)Returns true if two codesets are compatible.
 | 
| static boolean | compatible(int csA,
           int csB)Returns true if two codesets are compatible.
 | 
|  boolean | forServer()Return whether the codeset is to be used in server profiles or not.
 | 
|  int | getAlignment()Return the alignment for this codeset.
 | 
|  java.lang.String | getCanonicalName()Returns the canonical Java name for the codeset.
 | 
|  short[] | getCharsets()Return the array of charsets covered by this codeset.
 | 
|  java.lang.String | getDescription()Return the description of this codeset.
 | 
|  int | getId()Return the id of this codeset.
 | 
|  int | getMaxSize()Return the maximum number of bytes used by this codeset.
 | 
|  java.lang.String | getName()Return the name of this codeset.
 | 
|  boolean | isCompatibleTo(CodeSet to_comp)Compare this codeset to the specified one.
 | 
|  java.lang.String | toString()This method is used to create a stringified representation of
 an entry.
 | 
 
| Methods inherited from class java.lang.Object | 
| equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
 
CodeSet
public CodeSet(java.lang.String description,
               int id,
               short[] charsets,
               int maxSize,
               java.lang.String canonical,
               java.lang.String name,
               int alignment,
               boolean server)
- Constructor.
 This constructor populates all the fields of this class.
getId
public int getId()
- Return the id of this codeset.
 The id is an unsigned 32bit integer from the OSF charset and codeset registry.
getCanonicalName
public java.lang.String getCanonicalName()
- Returns the canonical Java name for the codeset.
getName
public java.lang.String getName()
- Return the name of this codeset.
 This is not the canonical Java name of the codeset. This name has been
 entered during the first/last run of the CodeSetDatabase.main() method
 and has not been changed since then. This name is canonicalized before
 it is used in the Java environment. The reason why this name isn't
 changed to the canonical name per default is that there are several
 codesets mapped on to the same Java name. For example the several
 UCS Level 1-3 and the UTF-16BE codesets. In Java all of them are mapped
 to UnicodeBigUnmarked. When object references are printed to the command
 line we want the names as defined in the OSF codeset registry and not
 the Java canonical name, because it will be no longer comparable to
 object references from e.g. C/C++ environments where the Java canonical
 name isn't known.
getDescription
public java.lang.String getDescription()
- Return the description of this codeset.
 The description from the OSF charset and codeset registry.
getCharsets
public short[] getCharsets()
- Return the array of charsets covered by this codeset.
 A charset registry entry is represented by an unsigned 16bit short value
 as defined in the OSF charset and codeset registry.
getMaxSize
public int getMaxSize()
- Return the maximum number of bytes used by this codeset.
 There are two main types of codesets: byte-oriented and non-byte-oriented.
 The byte-oriented have another two sub-categories: single-byte and multi-byte.
 This makes three different types regarding to the length in bytes:
 single-byte, variable-length multi-byte, and fixed-length multi-byte.
getAlignment
public int getAlignment()
- Return the alignment for this codeset.
 This value has been supplied by the first run of the CodeSetDatabaseInitializer.main()
 method and is reused each time the CodeSetDatabase class is regenerated.
 The reason why the CodeSetDatabase.getAlignmentFromId returns another value
 than this method is currently unknown.- 
- Returns:
- The aligment for the specified codeset
 
forServer
public boolean forServer()
- Return whether the codeset is to be used in server profiles or not.
 This flag can be specified in the interactive mode when creating the
 CodeSetDatabase file. The reason why some codesets are marked for
 client use only is currently unknown.
toString
public java.lang.String toString()
- This method is used to create a stringified representation of
 an entry.- 
- Overrides:
- toStringin class- java.lang.Object
 
isCompatibleTo
public boolean isCompatibleTo(CodeSet to_comp)
- Compare this codeset to the specified one.- 
- Parameters:
- to_comp- The codest to compare this one to.
- Returns:
- True if the codesets are compatible, false otherwise.
 
compatible
public static boolean compatible(int csA,
                                 int csB)
- Returns true if two codesets are compatible.- 
- Parameters:
- csA- codeset id for codeset A.
- csB- codeset id for codeset B.
- Returns:
- True when codeset B is compatible to codeset A. False otherwise.
 
compatible
public static boolean compatible(CodeSet entryA,
                                 CodeSet entryB)
- Returns true if two codesets are compatible.
 For example, when codeset A maps 3 charsets and codeset B only 2
 then they are not compatible, because codeset A can represent more
 charsets than codeset B and a comparison of the character sets doesn't 
 matter. When codeset A maps 3 charsets and codeset B
 3 or more, then the charsets are compatible when all one charset from
 codeset A and one charset from codeset B match.
 CORBA 2.5 chapter 13.10.5.1:
 Compatibility  is determined with respect to two code sets by examining 
 their entries in the registry, paying special attention to the character 
 sets encoded by each code set. For each of the two code sets, an attempt 
 is made to see if there is at least one (fuzzy-defined) character set in 
 common, and if such a character set is found, then the assumption is made 
 that these code sets are  compatible.  Obviously, applications which 
 exploit parts of a character set not properly encoded in this scheme will 
 suffer information loss when communicating with another application in 
 this  fuzzy  scheme.- 
- Parameters:
- codesetA- Codeset A.
- codesetB- Codeset B.
- Returns:
- True when codeset B is compatible to codeset A. False otherwise.