Package net.sf.saxon.serialize.charcode

## Class CharacterSetFactory

- java.lang.Object
- - net.sf.saxon.serialize.charcode.CharacterSetFactory

-     public class CharacterSetFactory
      extends java.lang.Object

  This class delivers a CharacterSet object for a given named encoding.

  It maintains a mapping from character set names to class names, and a separate mapping from character set names to instances of those classes. This means that a class is not actually instantiated until the encoding is used, but once instantiated, the same instance is used whenever that encoding is used again in the same Configuration.

  Note that the purpose of the CharacterSet object is only to record which Unicode characters are represented in the encoding, so that non-encodable characters can be represented as XML or HTML character references. The actual translation from Unicode codepoints to bytes in the chosen encoding is left to the Java IO library.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CharacterSetFactory()` | Class has a single instance per Configuration

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `CharacterSet` | `getCharacterSet​(java.lang.String encoding)` | Make a CharacterSet appropriate to the encoding
    `CharacterSet` | `getCharacterSet​(java.util.Properties details)` | Make a CharacterSet appropriate to the encoding
    `static void` | `main​(java.lang.String[] args)` | Main program is a utility to give a list of the character sets supported by the Java VM
    `void` | `setCharacterSetImplementation​(java.lang.String encoding, CharacterSet charSet)` | Register an implementation of a character set, using the class name

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CharacterSetFactory

          public CharacterSetFactory()

      Class has a single instance per Configuration

  - ### Method Detail

    - #### setCharacterSetImplementation

          public void setCharacterSetImplementation​(java.lang.String encoding,
                                                    CharacterSet charSet)

      Register an implementation of a character set, using the class name
      Parameters:
        `encoding` - the name of the character set
        `charSet` - the name of a class that implements `CharacterSet`

    - #### getCharacterSet

          public CharacterSet getCharacterSet​(java.util.Properties details)
                                       throws XPathException

      Make a CharacterSet appropriate to the encoding
      Parameters:
        `details` - the serialization properties
      Returns:
        the constructed CharacterSet
      Throws:
        `XPathException`

    - #### getCharacterSet

          public CharacterSet getCharacterSet​(java.lang.String encoding)
                                       throws XPathException

      Make a CharacterSet appropriate to the encoding
      Parameters:
        `encoding` - the required encoding
      Returns:
        the constructed CharacterSet
      Throws:
        `XPathException`

    - #### main

          public static void main​(java.lang.String[] args)
                           throws java.lang.Exception

      Main program is a utility to give a list of the character sets supported by the Java VM
      Parameters:
        `args` - command line arguments (none needed)
      Throws:
        `java.lang.Exception`