T
- defines the NAS PDU type.public class NasCoder<T extends AbstractData>
extends java.lang.Object
NasCoder
can
Modifier and Type | Field and Description |
---|---|
Originator |
originator
Identifies the originator of an NAS message.
|
Modifier and Type | Method and Description |
---|---|
T |
decode(java.nio.ByteBuffer nasMessage)
Decodes a binary NAS message into a Java object.
|
java.lang.String |
decodeToJSON(java.nio.ByteBuffer nasMessage)
Converts a binary NAS message to a JSON value.
|
java.lang.String |
decodeToText(java.nio.ByteBuffer nasMessage)
Converts a binary NAS message to ASN.1 value notation format.
|
java.lang.String |
decodeToXML(java.nio.ByteBuffer nasMessage)
Converts a binary NAS message to an XML document.
|
Diagnostics |
diagnostics()
Returns the diagnostic report created by the most recent invocation of the
NasCoder API. |
java.nio.ByteBuffer |
encode(T nasMessage)
Encodes the Java object that represents the NAS message into binary bytes.
|
java.nio.ByteBuffer |
encode(T nasMessage,
java.nio.ByteBuffer sink)
Attempts to encode the Java object that represents the NAS message into a
pre-allocated buffer.
|
JSONOptions |
getJSONOptions()
Retrieves the current formatting options that are used when the NAS message is converted
to JSON format.
|
TextOptions |
getTextOptions()
Retrieves the current formatting options that are used when the NAS message is converted
to ASN.1 value notation format.
|
XMLOptions |
getXMLOptions()
Retrieves the current formatting options that are used when the NAS message is converted
to an XML document.
|
boolean |
hasDiagnostics()
Indicates whether the most recent invocation of the
NasCoder API
revealed defects in the NAS message. |
java.lang.String |
printJSON(T nasMessage)
Converts the Java object that represents the NAS message to a JSON value.
|
java.lang.String |
printMessage(T nasMessage)
Converts the Java object that represents the NAS message into ASN.1 value notation format.
|
java.lang.String |
printXML(T nasMessage)
Converts the Java object that represents the NAS message to an XML document.
|
void |
setJSONOptions(JSONOptions options)
Specifies the formatting options that are used when the NAS message is converted
to JSON format.
|
void |
setTextOptions(TextOptions options)
Specifies the formatting options that are used when the NAS message is converted
to ASN.1 value notation format.
|
void |
setXMLOptions(XMLOptions options)
Specifies the formatting options that are used when the NAS message is converted
to an XML document.
|
public Originator originator
public java.lang.String decodeToJSON(java.nio.ByteBuffer nasMessage) throws NASDecodeFailedException
nasMessage
- the binary NAS message.String
that contains the JSON value.NASDecodeFailedException
- when the conversion fails because the binary
message is syntactically invalid and cannot be decoded.public java.lang.String decodeToXML(java.nio.ByteBuffer nasMessage) throws NASDecodeFailedException
nasMessage
- the binary NAS message.String
that contains the XML document.NASDecodeFailedException
- when the conversion fails because the binary
message is syntactically invalid and cannot be decoded.public java.lang.String decodeToText(java.nio.ByteBuffer nasMessage) throws NASDecodeFailedException
nasMessage
- the binary NAS message.String
that contains the ASN.1 value notation of the message.NASDecodeFailedException
- when the conversion fails because the binary
message is syntactically invalid and cannot be decoded.public T decode(java.nio.ByteBuffer nasMessage) throws NASDecodeFailedException
nasMessage
- the binary NAS message.NASDecodeFailedException
- when the binary message is syntactically
invalid and cannot be decoded.public java.nio.ByteBuffer encode(T nasMessage) throws NASEncodeFailedException
ByteBuffer
object that receives the binary bytes is allocated
dynamically. The returned ByteBuffer
is not flipped. You must invoke
its flip()
method before using it.nasMessage
- the Java object that represents the NAS message.ByteBuffer
object that contains the encoded NAS message.NASEncodeFailedException
- when the message cannot be encoded because
the value represented by the nasMessage
has semantic errors.public java.nio.ByteBuffer encode(T nasMessage, java.nio.ByteBuffer sink) throws NASEncodeFailedException
ByteBuffer
object can differ from the ByteBuffer
passed in the sink
parameter. The returned ByteBuffer
is not
flipped. You must invoke its flip()
method before using it.nasMessage
- the Java object that represents the NAS message.sink
- the pre-allocated ByteBuffer
that will receive the encoded
data.ByteBuffer
object that contains the encoded NAS message.NASEncodeFailedException
- when the message cannot be encoded because
the value represented by the nasMessage
has semantic errors.public java.lang.String printJSON(T nasMessage)
decodeToJSON
method,
it does not throw an exception when the Java object has semantic errors but
returns a null String
. You can use the diagnostics()
method to retrieve the diagnostics report in that case.nasMessage
- the Java object that represents the NAS message.String
that contains the JSON object.public java.lang.String printXML(T nasMessage)
decodeToXML
method,
it does not throw an exception when the Java object has semantic errors but
returns a null String
. You can use the diagnostics()
method to retrieve the diagnostics report in that case.nasMessage
- the Java object that represents the NAS message.String
that contains the XML document.public java.lang.String printMessage(T nasMessage)
decodeToText
method,
it does not throw an exception when the Java object has semantic errors but
returns a null String
. You can use the diagnostics()
method to retrieve the diagnostics report in that case.nasMessage
- the Java object that represents the NAS message.String
that contains the ASN.1 value notation for the NAS message.public boolean hasDiagnostics()
NasCoder
API
revealed defects in the NAS message.NasCoder
API
reported some errors or warnings for the NAS message.public Diagnostics diagnostics()
NasCoder
API. If the operation aborted due to an exception, the
diagnostics report returned is identical to the diagnostics reported by the
diagnostics()
method of the NASException
.
Even when the exception is not thrown the operation can return a non-empty report because
the encoder or decoder detected non-critical defects that did not cause it to
treat the message as invalid.NasCoder
API.public void setJSONOptions(JSONOptions options)
options
- specifies the new JSON formatting options.public JSONOptions getJSONOptions()
public void setXMLOptions(XMLOptions options)
options
- specifies the new XML formatting options.public XMLOptions getXMLOptions()
public void setTextOptions(TextOptions options)
options
- specifies the new ASN.1 value notation formatting options.public TextOptions getTextOptions()
Copyright © 2023 OSS Nokalva, Inc. All rights reserved.
This document is proprietary to OSS Nokalva, Inc., and may be used only by their direct licensees. Distribution is not permitted. This copyright statement must not be removed.