org.apache.xml.serializer
Class EncodingInfo

java.lang.Object
  |
  +--org.apache.xml.serializer.EncodingInfo

public final class EncodingInfo
extends java.lang.Object

Holds information about a given encoding, which is the Java name for the encoding, the equivalent ISO name.

An object of this type has two useful methods

 isInEncoding(char ch);
 
which can be called if the character is not the high one in a surrogate pair and:
 isInEncoding(char high, char low);
 
which can be called if the two characters from a high/low surrogate pair.

An EncodingInfo object is a node in a binary search tree. Such a node will answer if a character is in the encoding, and do so for a given range of unicode values (m_first to m_last). It will handle a certain range of values explicitly (m_explFirst to m_explLast). If the unicode point is before that explicit range, that is it is in the range m_first <= value < m_explFirst, then it will delegate to another EncodingInfo object for The root of such a tree, m_before. Likewise for values in the range m_explLast < value <= m_last, but delgating to m_after

Actually figuring out if a code point is in the encoding is expensive. So the purpose of this tree is to cache such determinations, and not to build the entire tree of information at the start, but only build up as much of the tree as is used during the transformation.

This Class is not a public API, and should only be used internally within the serializer.

Usage:
**For internal use only**

Constructor Summary
EncodingInfo(java.lang.String name, java.lang.String javaName)
          Create an EncodingInfo object based on the ISO name and Java name.
 
Method Summary
 boolean isInEncoding(char ch)
          This is not a public API.
 boolean isInEncoding(char high, char low)
          This is not a public API.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodingInfo

public EncodingInfo(java.lang.String name,
                    java.lang.String javaName)
Create an EncodingInfo object based on the ISO name and Java name. If both parameters are null any character will be considered to be in the encoding. This is useful for when the serializer is in temporary output state, and has no assciated encoding.
Parameters:
name - reference to the ISO name.
javaName - reference to the Java encoding name.
Method Detail

isInEncoding

public boolean isInEncoding(char ch)
This is not a public API. It returns true if the char in question is in the encoding.
Parameters:
ch - the char in question.
Usage:
**For internal use only**

isInEncoding

public boolean isInEncoding(char high,
                            char low)
This is not a public API. It returns true if the character formed by the high/low pair is in the encoding.
Parameters:
high - a char that the a high char of a high/low surrogate pair.
low - a char that is the low char of a high/low surrogate pair.
Usage:
**For internal use only**


Copyright © 2005 Apache XML Project. All Rights Reserved.