Package com.oss.asn1
Class JSONCoder
java.lang.Object
com.oss.asn1.Coder
com.oss.asn1.JSONCoder
- All Implemented Interfaces:
XMLCoder
This class implements coding services for JSON Encoding Rules (JSON/ER).
- Since:
- ASN.1/Java 6.2
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add whitespace as necessary to improve readability of JSON document.void
Deprecated.void
Do not encode absent optional components (default).void
Do not encode absent components with DEFAULT (default).void
Deprecated.void
Do not generate whitespace into the JSON document.void
Deprecated.void
Do encode absent optional components as properties with the value 'null'.void
Do encode absent components with DEFAULT as present with the default value.void
Deprecated.void
Do encode value of BIT STRING or OCTET STRING with contents constraint which does not contain ENCODED BY as hex string.void
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.int
Get the number of spaces allocated for indentingboolean
Deprecated.boolean
Deprecated.void
setIndentWidth
(int width) Set indentation width for generating whitespaceMethods inherited from class com.oss.asn1.Coder
decode, decode, decodePartial, decodePartial, disableAutomaticDecoding, disableAutomaticEncoding, disableContainedValueDecoding, disableContainedValueEncoding, disableDecoderConstraints, disableDecoderDebugging, disableDeferredDecoding, disableEncoderConstraints, disableEncoderDebugging, disableRelaxedDecoding, disableRichDecoderExceptions, disableStrictDecoding, disableTruncatedZeroSecondsInGeneralizedTime, disableTruncatedZeroSecondsInUTCTime, disableXERCoderInterface, enableAutomaticDecoding, enableAutomaticEncoding, enableContainedValueDecoding, enableContainedValueDecoding, enableContainedValueEncoding, enableDecoderConstraints, enableDecoderDebugging, enableDeferredDecoding, enableEncoderConstraints, enableEncoderDebugging, enableRelaxedDecoding, enableRichDecoderExceptions, enableStrictDecoding, enableTruncatedZeroSecondsInGeneralizedTime, enableTruncatedZeroSecondsInUTCTime, enableXERCoderInterface, encode, encode, encode, excludeXMLDeclaration, getDecoderDebugOut, getDecoderDebugProperties, getEncoderDebugOut, getEncoderDebugProperties, getNumberOfPaddingBits, includeXMLDeclaration, isPDUDetectionAvailable, isUnknownExtensionFound, setDecoderDebugOut, setDecoderDebugProperties, setEncoderDebugOut, setEncoderDebugProperties, toString, useDefiniteLengthEncoding, useIndefiniteLengthEncoding, usingDefiniteLengthEncoding, validate
-
Field Details
-
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 classCoder
-
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 classCoder
-
disableEncodingOfAbsentComponents
public void disableEncodingOfAbsentComponents()Do not encode absent optional components (default).- Overrides:
disableEncodingOfAbsentComponents
in classCoder
-
enableEncodingOfAbsentComponents
public void enableEncodingOfAbsentComponents()Do encode absent optional components as properties with the value 'null'.- Overrides:
enableEncodingOfAbsentComponents
in classCoder
-
disableEncodinOfImpliedValues
public void disableEncodinOfImpliedValues()Do not encode absent components with DEFAULT (default).- Overrides:
disableEncodinOfImpliedValues
in classCoder
-
enableEncodingOfImpliedValues
public void enableEncodingOfImpliedValues()Do encode absent components with DEFAULT as present with the default value.- Overrides:
enableEncodingOfImpliedValues
in classCoder
-
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.This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer. -
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.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.This method is deprecated because the JSON wrapper encoder option has been removed from the JER and is not supported any longer. -
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.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 classCoder
- Parameters:
width
- number of spaces for indenting
-
getIndentWidth
public int getIndentWidth()Get the number of spaces allocated for indenting- Overrides:
getIndentWidth
in classCoder
- Returns:
- indentation width setting
-
getTransferSyntax
- Specified by:
getTransferSyntax
in classCoder
- Returns:
- identifier of this coder encoding rules.
-