Package com.oss.asn1

Class JSONCoder

java.lang.Object
com.oss.asn1.Coder
com.oss.asn1.JSONCoder
All Implemented Interfaces:
XMLCoder

public final class JSONCoder extends Coder implements XMLCoder
This class implements coding services for JSON Encoding Rules (JSON/ER).
Since:
ASN.1/Java 6.2
  • Field Details

    • ID

      public static final String ID
      The ID string identifies JSON encoding rules. The string should be used as relayID when storing unknown extension additions encoded with JSON.
      See Also:
  • Method Details

    • enableCompact

      public void enableCompact()
      Do not generate whitespace into the JSON document. In the compact mode the encoding is written without any whitespace as a single line of text. If the compact mode is disabled newlines are inserted as necessary and the indentation is applied.
      Overrides:
      enableCompact in class Coder
    • disableCompact

      public void disableCompact()
      Add whitespace as necessary to improve readability of JSON document. In the compact mode the encoding is written without any whitespace as a single line of text. If the compact mode is disabled newlines are inserted as necessary and the indentation is applied.
      Overrides:
      disableCompact in class Coder
    • disableEncodingOfAbsentComponents

      public void disableEncodingOfAbsentComponents()
      Do not encode absent optional components (default).
      Overrides:
      disableEncodingOfAbsentComponents in class Coder
    • enableEncodingOfAbsentComponents

      public void enableEncodingOfAbsentComponents()
      Do encode absent optional components as properties with the value 'null'.
      Overrides:
      enableEncodingOfAbsentComponents in class Coder
    • disableEncodinOfImpliedValues

      public void disableEncodinOfImpliedValues()
      Do not encode absent components with DEFAULT (default).
      Overrides:
      disableEncodinOfImpliedValues in class Coder
    • enableEncodingOfImpliedValues

      public void enableEncodingOfImpliedValues()
      Do encode absent components with DEFAULT as present with the default value.
      Overrides:
      enableEncodingOfImpliedValues in class Coder
    • encodeContainedValuesAsText

      public void encodeContainedValuesAsText()
      Do encode value of BIT STRING or OCTET STRING with contents constraint which does not contain ENCODED BY as {"containing":JSON_value} where JSON_value' is the contained value.
    • encodeContainedValuesAsHex

      public void encodeContainedValuesAsHex()
      Do encode value of BIT STRING or OCTET STRING with contents constraint which does not contain ENCODED BY as hex string.
    • disablePduWrapping

      @Deprecated public void disablePduWrapping()
      Deprecated.
      This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer.
    • enablePduWrapping

      @Deprecated public void enablePduWrapping()
      Deprecated.
      This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer.
    • isPduWrappingEnabled

      @Deprecated public boolean isPduWrappingEnabled()
      Deprecated.
      This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer.
      Returns:
      false;
    • disableContainedValuesWrapping

      @Deprecated public void disableContainedValuesWrapping()
      Deprecated.
      This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer.
    • enableContainedValuesWrapping

      @Deprecated public void enableContainedValuesWrapping()
      Deprecated.
      This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer.
    • isContainedValuesWrappingEnabled

      @Deprecated public boolean isContainedValuesWrappingEnabled()
      Deprecated.
      This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer.
      Returns:
      false;
    • setIndentWidth

      public void setIndentWidth(int width)
      Set indentation width for generating whitespace
      Overrides:
      setIndentWidth in class Coder
      Parameters:
      width - number of spaces for indenting
    • getIndentWidth

      public int getIndentWidth()
      Get the number of spaces allocated for indenting
      Overrides:
      getIndentWidth in class Coder
      Returns:
      indentation width setting