Class ASN1CharStrConvMap


  • public class ASN1CharStrConvMap
    extends java.lang.Object
    Maps a ASN.1 character string type to a charset encoder and decoder. The converter is used to convert a DerValue of a ASN.1 character string type from bytes to unicode characters and vice versa.

    A global default ASN1CharStrConvMap is created when the class is initialized. The global default map is extensible.

    Author:
    Lily Hsiao, Slava Galperin
    • Constructor Summary

      Constructors 
      Constructor Description
      ASN1CharStrConvMap()
      Constructs a ASN1CharStrConvMap.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntry​(byte tag, java.nio.charset.Charset charset)
      Add a tag-charset entry in the map.
      java.nio.charset.CharsetDecoder getDecoder​(byte tag)
      Get a decoder for the given DER tag.
      static ASN1CharStrConvMap getDefault()
      Get the global ASN1CharStrConvMap.
      java.nio.charset.CharsetEncoder getEncoder​(byte tag)
      Get an encoder for the specified DER tag.
      java.util.Iterator<java.lang.Byte> getTags()
      Get an iterator of all tags in the map.
      static void setDefault​(ASN1CharStrConvMap newDefault)
      Set the global default ASN1CharStrConvMap.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ASN1CharStrConvMap

        public ASN1CharStrConvMap()
        Constructs a ASN1CharStrConvMap.
    • Method Detail

      • getEncoder

        public java.nio.charset.CharsetEncoder getEncoder​(byte tag)
        Get an encoder for the specified DER tag.
        Parameters:
        tag - A DER tag of a ASN.1 character string type, for example DerValue.tag_PrintableString.
        Returns:
        An encoder for the DER tag.
      • getDecoder

        public java.nio.charset.CharsetDecoder getDecoder​(byte tag)
        Get a decoder for the given DER tag.
        Parameters:
        tag - A DER tag of a ASN.1 character string type, for example DerValue.tag_PrintableString.
        Returns:
        A decoder for the DER tag.
      • addEntry

        public void addEntry​(byte tag,
                             java.nio.charset.Charset charset)
        Add a tag-charset entry in the map.
        Parameters:
        tag - A DER tag of a ASN.1 character string type, ex. DerValue.tag_IA5String
        charset - A charset for the tag.
      • getTags

        public java.util.Iterator<java.lang.Byte> getTags()
        Get an iterator of all tags in the map.
        Returns:
        An Iterator of DER tags in the map as Bytes.
      • getDefault

        public static ASN1CharStrConvMap getDefault()
        Get the global ASN1CharStrConvMap.
        Returns:
        The global default ASN1CharStrConvMap.
      • setDefault

        public static void setDefault​(ASN1CharStrConvMap newDefault)
        Set the global default ASN1CharStrConvMap.
        Parameters:
        newDefault - The new default ASN1CharStrConvMap.