Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## util
Class HNSOctetUCSMap

    java.lang.Object
      util.HNSOctetUCSMap

    public class HNSOctetUCSMap

extends java.lang.Object

Defines mappings in both directions between HNS 8-bit character code values (octets) and HamNoSys-UCS characters, most of which are in the UCS private use area. There are factory methods providing access to singleton instances, one which maps all UCS character values, and one which leaves UCS values below 256 unchanged.

Field Summary
`protected static java.lang.String` | `HNS_OCTET_UCS_PROPS_FILE` Path for standard HNS mapping file.
`protected static java.lang.String` | `HNS_UNUSED` Token for unused entry in mapping file.
`static int` | `O_HAMSPACE` "hamspace" octet value.
`static int` | `O_HAMVERSION40` "hamversion40" octet value.
`static int` | `O_LIMIT` Octet limit value.
`static int` | `O_NULL` "Null" octet value.
`protected char[]` | `o2u` Map classic HNS octets to HNS-4 UCS codepoints.
`protected char` | `U_HAMSPACE` "hamspace" UCS value.
`protected char` | `U_HAMVERSION40` "hamversion40" UCS value.
`static char` | `U_NULL` "Null" UCS value.
`protected java.util.HashMap<java.lang.Character,java.lang.Integer>` | `u2o` Map HNS-4 UCS codepoints to classic HNS octets.

Constructor Summary
`protected` | `HNSOctetUCSMap(java.lang.String propspath, boolean DO_ALL_UCS)` Constructs a new map as defined by the given properties file.

Method Summary
`char` | `cleanHNS8(char u)` Acts like `hns8(char)`, unless the given character is a whitespace character, in which case the result is the "null" HNS value, 0.
`java.lang.String` | `cleanHNS8(java.lang.String hns8, int ix)` Returns a clean version of the given string, eliminating any invalid HNS-8 characters, and outputs a message mentioning the given index for each invalid character.
`java.lang.String` | `cleanHNSU(java.lang.String hnsu, int ix)` Returns a clean version of the given string, eliminating any invalid or whitespace HNS-UCS characters, and outputs a message mentioning the given index for each rejected character.
`char` | `cleanUCS(int o)` Acts like `ucs(int)`, unless the given code represents a whitespace character, in which case the result is the "null" UCS value, U+FFFF.
`protected static int` | `getFirstPropsInt(java.util.Properties props, java.lang.String istr)` Looks up the given string in the given properties set, and tries to interpret the first token in the result as an integer value, returning this value if successful, or the null UCS value otherwise.
`protected static java.lang.String` | `getFirstPropsToken(java.util.Properties props, java.lang.String istr)` Looks up the given string in the given properties set, and returns the first token in the result if possible, or returns `null` in any case of failure.
`static HNSOctetUCSMap` | `getHNSMapOctetAllUCS()` Factory method, returning a the singleton map that includes all UCS HamNoSys character values.
`static HNSOctetUCSMap` | `getHNSMapOctetHighUCS()` Factory method, returning the singleton map that includes high UCS HamNoSys character values only.
`static HNSOctetUCSMap` | `getHNSMapOctetUCS(boolean DO_ALL_UCS)` Factory method, returning one of two singleton instances of this class, depending on the value of the given flag `DO_ALL_UCS`: if this flag is false then only high (`>= 256`) character values are included in the mapping, but if it is true all values, including those such as UCS value 44 (`hamcomma`, for which the corresponding value in the old 8-bit HNS code is the octet value 36.
`char` | `hns8(char u)` If the given character value is an HNS-4 UCS character, returns (as a character) the corresponding classic HNS octet, otherwise the "null" HNS value, 0.
`java.lang.String` | `hns8(java.lang.String ustr)` Returns (as a character-string) the sequence of classic HNS octets corresponding to the given sequence of HNS-4 UCS characters.
`int` | `octet(char u)` Returns the same value as `hns8(char)` (as an int).
`java.lang.String` | `ucs(byte[] octets)` Returns the string of HNS-4 UCS characters corresponding to the given sequence of classic HNS octet values.
`char` | `ucs(int o)` Returns the HNS-4 UCS character for the given classic HNS octet value.
`java.lang.String` | `ucs(java.lang.String ostr)` Returns the string of HNS-4 UCS characters corresponding to the given string of classic HNS octet values.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HNS_UNUSED

    protected static final java.lang.String HNS_UNUSED

  Token for unused entry in mapping file.

  See Also:
    Constant Field Values

### HNS_OCTET_UCS_PROPS_FILE

    protected static final java.lang.String HNS_OCTET_UCS_PROPS_FILE

  Path for standard HNS mapping file.

  See Also:
    Constant Field Values

### O_NULL

    public static final int O_NULL

  "Null" octet value.

  See Also:
    Constant Field Values

### O_LIMIT

    public static final int O_LIMIT

  Octet limit value.

  See Also:
    Constant Field Values

### U_NULL

    public static final char U_NULL

  "Null" UCS value.

  See Also:
    Constant Field Values

### O_HAMVERSION40

    public static final int O_HAMVERSION40

  "hamversion40" octet value.

  See Also:
    Constant Field Values

### O_HAMSPACE

    public static final int O_HAMSPACE

  "hamspace" octet value.

  See Also:
    Constant Field Values

### o2u

    protected char[] o2u

  Map classic HNS octets to HNS-4 UCS codepoints.

### u2o

    protected java.util.HashMap<java.lang.Character,java.lang.Integer> u2o

  Map HNS-4 UCS codepoints to classic HNS octets.

### U_HAMVERSION40

    protected final char U_HAMVERSION40

  "hamversion40" UCS value.

### U_HAMSPACE

    protected final char U_HAMSPACE

  "hamspace" UCS value.

Constructor Detail

### HNSOctetUCSMap

    protected HNSOctetUCSMap(java.lang.String propspath,
                             boolean DO_ALL_UCS)

  Constructs a new map as defined by the given properties file.

Method Detail

### getHNSMapOctetHighUCS

    public static final HNSOctetUCSMap getHNSMapOctetHighUCS()

  Factory method, returning the singleton map that includes high UCS HamNoSys character values only.

### getHNSMapOctetAllUCS

    public static final HNSOctetUCSMap getHNSMapOctetAllUCS()

  Factory method, returning a the singleton map that includes all UCS HamNoSys character values.

### getHNSMapOctetUCS

    public static final HNSOctetUCSMap getHNSMapOctetUCS(boolean DO_ALL_UCS)

  Factory method, returning one of two singleton instances of this class, depending on the value of the given flag `DO_ALL_UCS`: if this flag is false then only high (`>= 256`) character values are included in the mapping, but if it is true all values, including those such as UCS value 44 (`hamcomma`, for which the corresponding value in the old 8-bit HNS code is the octet value 36.

### ucs

    public char ucs(int o)

  Returns the HNS-4 UCS character for the given classic HNS octet value.

### cleanUCS

    public char cleanUCS(int o)

  Acts like `ucs(int)`, unless the given code represents a whitespace character, in which case the result is the "null" UCS value, U+FFFF.

### ucs

    public java.lang.String ucs(byte[] octets)

  Returns the string of HNS-4 UCS characters corresponding to the given sequence of classic HNS octet values.

### ucs

    public java.lang.String ucs(java.lang.String ostr)

  Returns the string of HNS-4 UCS characters corresponding to the given string of classic HNS octet values.

### octet

    public int octet(char u)

  Returns the same value as `hns8(char)` (as an int).

### hns8

    public char hns8(char u)

  If the given character value is an HNS-4 UCS character, returns (as a character) the corresponding classic HNS octet, otherwise the "null" HNS value, 0.

### cleanHNS8

    public char cleanHNS8(char u)

  Acts like `hns8(char)`, unless the given character is a whitespace character, in which case the result is the "null" HNS value, 0.

### hns8

    public java.lang.String hns8(java.lang.String ustr)

  Returns (as a character-string) the sequence of classic HNS octets corresponding to the given sequence of HNS-4 UCS characters.

### cleanHNSU

    public java.lang.String cleanHNSU(java.lang.String hnsu,
                                      int ix)

  Returns a clean version of the given string, eliminating any invalid or whitespace HNS-UCS characters, and outputs a message mentioning the given index for each rejected character.

### cleanHNS8

    public java.lang.String cleanHNS8(java.lang.String hns8,
                                      int ix)

  Returns a clean version of the given string, eliminating any invalid HNS-8 characters, and outputs a message mentioning the given index for each invalid character.

### getFirstPropsInt

    protected static int getFirstPropsInt(java.util.Properties props,
                                          java.lang.String istr)

  Looks up the given string in the given properties set, and tries to interpret the first token in the result as an integer value, returning this value if successful, or the null UCS value otherwise.

### getFirstPropsToken

    protected static java.lang.String getFirstPropsToken(java.util.Properties props,
                                                         java.lang.String istr)

  Looks up the given string in the given properties set, and returns the first token in the result if possible, or returns `null` in any case of failure.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD