|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objsys.asn1j.runtime.Asn1MessageBufferBase com.objsys.asn1j.runtime.Asn1MessageBuffer com.objsys.asn1j.runtime.Asn1EncodeBuffer com.objsys.asn1j.runtime.Asn1XerEncodeBuffer
public class Asn1XerEncodeBuffer
This class handles the encoding of ASN.1 messages as specified in the XML Encoding Rules (XER) as specified in the ITU-T X.693 standard.
Field Summary |
---|
Fields inherited from class com.objsys.asn1j.runtime.Asn1EncodeBuffer |
---|
INITIAL_SIZE, mByteIndex, mData |
Fields inherited from class com.objsys.asn1j.runtime.Asn1MessageBufferBase |
---|
context, mTypeCode |
Fields inherited from interface com.objsys.asn1j.runtime.Asn1XerEncoder |
---|
XERDATA, XEREND, XERINDENT, XERINIT, XERSTART |
Constructor Summary | |
---|---|
Asn1XerEncodeBuffer()
The default constructor creates an XER encode buffer object with the default initial size and canonical set to false. |
|
Asn1XerEncodeBuffer(boolean canonical)
The parameterized constructor creates an XER encode buffer object with default initial size and canonical set to the given values. |
|
Asn1XerEncodeBuffer(boolean canonical,
int size)
The parameterized constructor creates an XER encode buffer object with initial size increment and canonical set to the given values. |
Method Summary | |
---|---|
void |
binDump(java.io.PrintStream out,
java.lang.String varName)
This method dumps the encoded message in a human-readable format showing a bit trace of all fields to the given print output stream. |
void |
copy(byte value)
This method is used to copy a single byte to the encode buffer. |
void |
copy(byte[] value)
This method copies multiple bytes to the encode buffer. |
void |
copy(byte[] value,
int off,
int len)
This method copies multiple bytes to the encode buffer. |
void |
copy(java.lang.String value)
This method copies a character string to the encode buffer. |
void |
decrLevel()
This method decrements the element nesting level counter. |
void |
encodeBinStrValue(byte[] bits,
int nbits)
This method encodes XML binary string data |
void |
encodeByte(byte value)
This method is used to encode a single byte to the encode buffer. |
void |
encodeData(java.lang.String value)
This method encodes XML string data |
void |
encodeEmptyElement(java.lang.String elemName)
This method encodes an XML empty element tag |
void |
encodeEndDocument()
This method encodes standard trailor information at the end of the XML document. |
void |
encodeEndElement(java.lang.String elemName)
This method encodes an XML end element tag |
void |
encodeHexStrValue(byte[] data)
This method encodes XML hexadecimal string data |
void |
encodeNamedValue(java.lang.String valueName,
java.lang.String elemName)
This method encodes an XML named value (with start and end tags) |
void |
encodeNamedValueElement(java.lang.String elemName)
This method encodes an XML named value element tag |
void |
encodeRealValue(double value,
java.lang.String elemName)
This method encodes an XML REAL (double) value (with start and end tags). |
void |
encodeStartDocument()
This method encodes standard header information at the beginning of the XML document. |
void |
encodeStartElement(java.lang.String elemName)
This method encodes an XML start element tag |
byte[] |
getBuffer()
This method returns a reference to the byte buffer used to hold the encoded message. |
java.io.InputStream |
getInputStream()
This method returns an input stream object reference to the message buffer contents (i.e. the encoded data). |
byte[] |
getMsgCopy()
This method returns the encoded message in a byte array. |
int |
getMsgLength()
This method returns the length (in bytes) of the encoded message component. |
int |
getState()
This method gets the state of the buffer. |
void |
incrLevel()
This method increments the element nesting level counter. |
void |
indent()
This methods indents by adding a new-line followed by whitespace corresponding to the current nesting level to the encode buffer. |
void |
reset()
This method resets the buffer to allow a new record to be encoded into it. |
void |
setCanonical(boolean value)
This method sets the canonical encoding flag to the given value. |
void |
setState(int stat)
This method sets the state of the buffer. |
void |
write(java.io.OutputStream out)
This method writes the encoded record to the given output stream. |
Methods inherited from class com.objsys.asn1j.runtime.Asn1EncodeBuffer |
---|
binDump, checkSize, hexDump, hexDump, initBuffer, trimBitString |
Methods inherited from class com.objsys.asn1j.runtime.Asn1MessageBuffer |
---|
addNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerList |
Methods inherited from class com.objsys.asn1j.runtime.Asn1MessageBufferBase |
---|
getContext, hexDump, hexDump, setKey, setTypeCode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.objsys.asn1j.runtime.Asn1XmlXerEncoder |
---|
getContext |
Constructor Detail |
---|
public Asn1XerEncodeBuffer()
public Asn1XerEncodeBuffer(boolean canonical)
canonical
- Boolean indicating a canonical or non-canonical
encoding should be produced as defined in the X.693 standard.public Asn1XerEncodeBuffer(boolean canonical, int size)
canonical
- Boolean indicating a canonical or non-canonical
encoding should be produced as defined in the X.693 standard.size
- The initial size in bytes of an encode buffer. If
this parameter is set to zero, the default size will be used.Method Detail |
---|
public void binDump(java.io.PrintStream out, java.lang.String varName)
binDump
in class Asn1EncodeBuffer
public void copy(byte value)
copy
in interface Asn1XmlXerEncoder
copy
in class Asn1EncodeBuffer
value
- The byte value to copypublic void copy(byte[] value) throws Asn1Exception
copy
in interface Asn1XmlXerEncoder
copy
in class Asn1EncodeBuffer
value
- Array of bytes to copy to the encode buffer
Asn1Exception
- Thrown, if operation is failed.public void copy(byte[] value, int off, int len) throws Asn1Exception
copy
in interface Asn1XmlXerEncoder
value
- Array of bytes to copy to the encode bufferoff
- Starting offset in arraylen
- The length to be encoded
Asn1Exception
- Thrown, if operation is failed.public void copy(java.lang.String value) throws Asn1Exception
copy
in interface Asn1XmlXerEncoder
value
- The string value to copy
Asn1Exception
- Thrown, if operation is failed.public void decrLevel()
decrLevel
in interface Asn1XmlXerEncoder
public void encodeByte(byte value)
value
- The byte value to copypublic void encodeData(java.lang.String value) throws Asn1Exception
encodeData
in interface Asn1XmlXerEncoder
value
- String value to encode
Asn1Exception
- Thrown, if operation is failed.public void encodeBinStrValue(byte[] bits, int nbits) throws Asn1Exception
encodeBinStrValue
in interface Asn1XmlXerEncoder
bits
- Bit string to encode
Asn1Exception
- Thrown, if operation is failed.public void encodeHexStrValue(byte[] data) throws Asn1Exception
encodeHexStrValue
in interface Asn1XmlXerEncoder
data
- Data to encode
Asn1Exception
- Thrown, if operation is failed.public void encodeEndDocument() throws Asn1Exception
encodeEndDocument
in interface Asn1XmlXerEncoder
Asn1Exception
- Thrown, if operation is failed.public void encodeEndElement(java.lang.String elemName) throws Asn1Exception
encodeEndElement
in interface Asn1XerEncoder
elemName
- The name of element.
Asn1Exception
- Thrown, if operation is failed.public void encodeStartDocument() throws Asn1Exception
encodeStartDocument
in interface Asn1XmlXerEncoder
Asn1Exception
- Thrown, if operation is failed.public void encodeStartElement(java.lang.String elemName) throws Asn1Exception
encodeStartElement
in interface Asn1XerEncoder
elemName
- The name of element.
Asn1Exception
- Thrown, if operation is failed.public void encodeEmptyElement(java.lang.String elemName) throws Asn1Exception
encodeEmptyElement
in interface Asn1XerEncoder
elemName
- The name of element.
Asn1Exception
- Thrown, if operation is failed.public void encodeNamedValueElement(java.lang.String elemName) throws Asn1Exception
encodeNamedValueElement
in interface Asn1XmlXerEncoder
elemName
- The name of element.
Asn1Exception
- Thrown, if operation is failed.public void encodeRealValue(double value, java.lang.String elemName) throws java.io.IOException, Asn1Exception
encodeRealValue
in interface Asn1XerEncoder
value
- The value to be encoded.elemName
- The name of element. If null, then start and end
tags won't be encoded.
java.io.IOException
- If I/O error occurs.
Asn1Exception
- Thrown, if operation is failed.public byte[] getBuffer()
public byte[] getMsgCopy()
getMsgCopy
in class Asn1EncodeBuffer
public int getMsgLength()
getMsgLength
in class Asn1EncodeBuffer
public java.io.InputStream getInputStream()
getInputStream
in class Asn1MessageBuffer
public int getState()
getState
in interface Asn1XerEncoder
public void incrLevel()
incrLevel
in interface Asn1XmlXerEncoder
public void indent() throws Asn1Exception
indent
in interface Asn1XmlXerEncoder
Asn1Exception
- Thrown, if operation is failed.public void reset()
reset
in class Asn1EncodeBuffer
public void setCanonical(boolean value)
value
- Canonical encoding flag.public void write(java.io.OutputStream out) throws java.io.IOException
write
in class Asn1EncodeBuffer
out
- Output stream to which record is to be written
java.io.IOException
public void setState(int stat)
setState
in interface Asn1XerEncoder
stat
- Buffer Statpublic void encodeNamedValue(java.lang.String valueName, java.lang.String elemName) throws Asn1Exception
encodeNamedValue
in interface Asn1XerEncoder
valueName
- The name of value.elemName
- The name of element.
Asn1Exception
- Thrown, if operation is failed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |