com.objsys.asn1j.runtime
Class Asn1XmlEncodeHelper

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1XmlEncodeHelper

public class Asn1XmlEncodeHelper
extends java.lang.Object


Constructor Summary
Asn1XmlEncodeHelper(Asn1XmlEncoder encoder)
           
 
Method Summary
 void encodeByte(byte value)
          This method is used to encode a single byte to the output stream.
 void encodeEmptyElement(java.lang.String elemName, java.lang.String nsPrefix)
          This method encodes an XML empty element tag
 void encodeEndElement(java.lang.String elemName, java.lang.String nsPrefix)
          This method encodes an XML end element tag
 void encodeNamespace(Asn1XmlNamespace namespace)
          Encode the given namespace on the next start element tag.
 void encodeNSAttrs()
          This method encodes XML namespace attributes in the form 'xmlns[:prefix]="uri"'.
 void encodeStartElement(java.lang.String elemName, java.lang.String nsPrefix, boolean terminate)
          This method encodes an XML start element tag.
 Asn1XmlNamespaceCtxt getNamespaceCtxt()
          This method gets the current namespace context.
 void setMixedContent(boolean value)
          This method sets the mixed content flag which indicates that this buffer will be used to encode mixed content.
 void setNamespaceCtxt(Asn1XmlNamespaceCtxt nsCtxt, boolean force)
          This method sets the namespace context to the given value.
 void setTermStart(boolean value)
          This method sets the start element termination required flag.
 void setXMLState(int value)
          This method sets the XML state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asn1XmlEncodeHelper

public Asn1XmlEncodeHelper(Asn1XmlEncoder encoder)
Method Detail

encodeByte

public void encodeByte(byte value)
                throws java.io.IOException
This method is used to encode a single byte to the output stream. It first converts the byte to a hex character representation and then copies it to the output buffer.

Parameters:
value - The byte value to copy
Throws:
java.io.IOException - Any exception thrown by the underlying OutputStream.

encodeStartElement

public void encodeStartElement(java.lang.String elemName,
                               java.lang.String nsPrefix,
                               boolean terminate)
                        throws Asn1Exception,
                               java.io.IOException
This method encodes an XML start element tag.

Parameters:
elemName - The name of element.
nsPrefix - The namespace prefix of element.
Throws:
Asn1Exception - Thrown, if operation is failed.
java.io.IOException

encodeNamespace

public void encodeNamespace(Asn1XmlNamespace namespace)
Encode the given namespace on the next start element tag.


encodeEndElement

public void encodeEndElement(java.lang.String elemName,
                             java.lang.String nsPrefix)
                      throws java.io.IOException,
                             Asn1Exception
This method encodes an XML end element tag

Parameters:
elemName - The name of element.
nsPrefix - Namespace prefix.
Throws:
java.io.IOException
Asn1Exception

encodeEmptyElement

public void encodeEmptyElement(java.lang.String elemName,
                               java.lang.String nsPrefix)
                        throws java.io.IOException,
                               Asn1Exception
This method encodes an XML empty element tag

Parameters:
elemName - The name of element.
nsPrefix - The namespace prefix of element.
Throws:
java.io.IOException
Asn1Exception

encodeNSAttrs

public void encodeNSAttrs()
                   throws Asn1Exception,
                          java.io.IOException
This method encodes XML namespace attributes in the form 'xmlns[:prefix]="uri"'.

Throws:
Asn1Exception
java.io.IOException

getNamespaceCtxt

public Asn1XmlNamespaceCtxt getNamespaceCtxt()
This method gets the current namespace context.

Returns:
Current namespace context

setMixedContent

public void setMixedContent(boolean value)
This method sets the mixed content flag which indicates that this buffer will be used to encode mixed content.

Parameters:
value - Boolean value

setNamespaceCtxt

public void setNamespaceCtxt(Asn1XmlNamespaceCtxt nsCtxt,
                             boolean force)
This method sets the namespace context to the given value. It is only set if it was not set previously (i.e. is non-null). To force the variable to be set regardless of current state, set the force flag to true.

Parameters:
nsCtxt - Reference to namespace context object.
force - Flag to indicate value should be set regardless of current state. If false, table will only be set if reference is currently null.

setTermStart

public void setTermStart(boolean value)
This method sets the start element termination required flag.

Parameters:
value - Boolean value

setXMLState

public void setXMLState(int value)
This method sets the XML state.

Parameters:
value - XML state value from Asn1XmlEncoder.