public class JsonEncoder extends AbstactEncoder implements IEncoder
ctx| Constructor and Description |
|---|
JsonEncoder(EncoderContext encoderContext,
JsonEncodingMode mode,
Writer writer)
Creates a new
JsonEncoder that will write to the given output. |
| Modifier and Type | Method and Description |
|---|---|
void |
beginArray() |
void |
beginArray(String fieldName) |
void |
beginObject() |
void |
beginObject(String fieldName) |
void |
close() |
void |
endArray() |
void |
endObject() |
JsonEncodingMode |
getEncodingMode()
Returns the
JsonEncodingMode of this JsonEncoder. |
List<Locale> |
getLocales()
The current Locale preferences.
|
void |
put(String fieldName,
Object value,
UaNodeId dataTypeId,
int dimensions)
Encodes the given field.
|
void |
putArrayElement(Object value) |
void |
putComma() |
void |
putDataValue(String fieldName,
DataValue value,
DataSetFieldContentMask fieldContentMask,
UaNodeId dataSetFieldDataType,
int valueRank)
Puts a DataValue, NOTE! this is only intended to be used by the SDK itself related to Part 14
PubSub.
|
void |
putObject(String fieldName,
Object value)
Deprecated.
|
void |
putSByte(String fieldName,
int value)
Puts SByte (
Byte), throws on failure. |
void |
putStructure(String fieldName,
Structure value)
Deprecated.
|
void |
putVariantArray(String fieldName,
Collection<Variant> value)
Deprecated.
|
String |
toString() |
getEncoderContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetEncoderContext, putBoolean, putBooleanArray, putBooleanArray, putByte, putByteArray, putByteArray, putByteString, putByteStringArray, putByteStringArray, putDataValue, putDataValueArray, putDataValueArray, putDateTime, putDateTimeArray, putDateTimeArray, putDiagnosticInfo, putDiagnosticInfoArray, putDiagnosticInfoArray, putDouble, putDouble, putDoubleArray, putDoubleArray, putExpandedNodeId, putExpandedNodeIdArray, putExpandedNodeIdArray, putExtensionObject, putExtensionObjectArray, putExtensionObjectArray, putFloat, putFloat, putFloatArray, putFloatArray, putGuid, putGuidArray, putGuidArray, putInt16, putInt16, putInt16Array, putInt16Array, putInt32, putInt32, putInt32Array, putInt32Array, putInt32Array, putInt64, putInt64, putInt64Array, putInt64Array, putLocalizedText, putLocalizedTextArray, putLocalizedTextArray, putNodeId, putNodeIdArray, putNodeIdArray, putQualifiedName, putQualifiedNameArray, putQualifiedNameArray, putSByte, putSByte, putSByteArray, putSByteArray, putStatusCode, putStatusCodeArray, putStatusCodeArray, putString, putStringArray, putStringArray, putUInt16, putUInt16Array, putUInt16Array, putUInt32, putUInt32Array, putUInt32Array, putUInt64, putUInt64Array, putUInt64Array, putVariant, putVariantArray, putXmlElement, putXmlElementArray, putXmlElementArraypublic JsonEncoder(EncoderContext encoderContext, JsonEncodingMode mode, Writer writer)
JsonEncoder that will write to the given output.public void beginArray()
throws EncodingException
EncodingExceptionpublic void beginArray(String fieldName) throws EncodingException
EncodingExceptionpublic void beginObject()
throws EncodingException
EncodingExceptionpublic void beginObject(String fieldName) throws EncodingException
EncodingExceptionpublic void close()
throws EncodingException
EncodingExceptionpublic void endArray()
throws EncodingException
EncodingExceptionpublic void endObject()
throws EncodingException
EncodingExceptionpublic JsonEncodingMode getEncodingMode()
JsonEncodingMode of this JsonEncoder.public List<Locale> getLocales()
IEncodergetLocales in interface IEncoderpublic void put(String fieldName, Object value, UaNodeId dataTypeId, int dimensions) throws EncodingException
IEncoderput in interface IEncoderfieldName - the name of the field (not used in all encodings e.g. Binary encodings do not
typically use a name, but JSON does).value - the value for the field, possibly null.dataTypeId - the OPC UA DataType of the field, not null.dimensions - the dimensions of the field, 0 if scalar, 1 if 1-dim array, etc.).EncodingException - in case the value cannot be encoded. Possible errors are e.g. giving
wrong DataType for a given value, giving wrong dimensions or giving values that are too
large for limits of the IEncoder.getEncoderContext().public void putArrayElement(Object value) throws EncodingException
EncodingExceptionpublic void putComma()
throws EncodingException
EncodingExceptionpublic void putDataValue(String fieldName, DataValue value, DataSetFieldContentMask fieldContentMask, UaNodeId dataSetFieldDataType, int valueRank) throws EncodingException
EncodingException@Deprecated public void putObject(String fieldName, Object value) throws EncodingException
EncodingExceptionpublic void putSByte(String fieldName, int value) throws EncodingException
IEncoderByte), throws on failure.putSByte in interface IEncoderEncodingException@Deprecated public void putStructure(String fieldName, Structure value) throws EncodingException
EncodingException@Deprecated public void putVariantArray(String fieldName, Collection<Variant> value) throws EncodingException
EncodingExceptionCopyright © 2026. All rights reserved.