Encoding
Date: 2017-05-25

org.apache.fontbox.encoding

## Class Encoding

- java.lang.Object
- - org.apache.fontbox.encoding.Encoding

- Direct Known Subclasses:
    BuiltInEncoding, CFFEncoding, MacRomanEncoding, StandardEncoding

      public abstract class Encoding
      extends java.lang.Object

  A PostScript Encoding vector.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.Integer,java.lang.String>` | `codeToName` This is a mapping from a character code to a character name.
    `protected java.util.Map<java.lang.String,java.lang.Integer>` | `nameToCode` This is a mapping from a character name to a character code.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Encoding()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addCharacterEncoding(int code, java.lang.String name)` This will add a character encoding.
    `java.lang.Integer` | `getCode(java.lang.String name)` This will get the character code for the name.
    `java.util.Map<java.lang.Integer,java.lang.String>` | `getCodeToNameMap()` Returns an unmodifiable view of the code to name mapping.
    `java.lang.String` | `getName(int code)` This will take a character code and get the name from the code.

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

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

- - ### Field Detail

    - #### codeToName

          protected java.util.Map<java.lang.Integer,java.lang.String> codeToName

      This is a mapping from a character code to a character name.

    - #### nameToCode

          protected java.util.Map<java.lang.String,java.lang.Integer> nameToCode

      This is a mapping from a character name to a character code.

  - ### Constructor Detail

    - #### Encoding

          public Encoding()

  - ### Method Detail

    - #### addCharacterEncoding

          protected void addCharacterEncoding(int code,
                                  java.lang.String name)

      This will add a character encoding.
      Parameters:
        `code` - The character code that matches the character.
        `name` - The name of the character.

    - #### getCode

          public java.lang.Integer getCode(java.lang.String name)

      This will get the character code for the name.
      Parameters:
        `name` - The name of the character.
      Returns:
        The code for the character or null if it is not in the encoding.

    - #### getName

          public java.lang.String getName(int code)

      This will take a character code and get the name from the code.
      Parameters:
        `code` - The character code.
      Returns:
        The name of the character.

    - #### getCodeToNameMap

          public java.util.Map<java.lang.Integer,java.lang.String> getCodeToNameMap()

      Returns an unmodifiable view of the code to name mapping.
      Returns:
        the Code2Name map