XCMS Toolkit

schemajic.encoder
Class CXEREncoder

java.lang.Object
  extended by schemajic.codec.Encoder
      extended by schemajic.encoder.BXEREncoder
          extended by schemajic.encoder.CXEREncoder
All Implemented Interfaces:
ValueVisitor

public class CXEREncoder
extends BXEREncoder
implements ValueVisitor

Encoder for Canonical XML Encoding Rules (CXER) of ASN.1.

Note that XML Comments and Processing Instructions are NOT standardized in BXER/CXER.

Version:
1.00 - 2006/02/12
Author:
support@phillipgriffin.com

Field Summary
 
Fields inherited from class schemajic.encoder.BXEREncoder
_binaryFormat, _buffer, _currentSchema, _curXmlFormat, _gtFormat, _output, _type, _useNamedIntegers
 
Constructor Summary
CXEREncoder()
           
 
Method Summary
protected  XmlWriter createXmlWriter(java.io.OutputStream out)
          Creates a new XML writer for the given output stream.
protected  void printArcs(int[] arcs)
           
protected  void printDefaultValue(ASN1Value value, Field fieldInfo)
           
 java.lang.Object visit(ASN1BitString value, java.lang.Object object)
          Encode the bits of the BIT STRING as a string of ones and zeroes with no trailing bits.
 java.lang.Object visit(ASN1Boolean value, java.lang.Object object)
          The only valid values for a BOOLEAN are 'true' or 'false'.
 java.lang.Object visit(ASN1Choice value, java.lang.Object object)
          Encode the value of the chosen field.
 java.lang.Object visit(ASN1Enumerated value, java.lang.Object object)
          Always print the named number as an empty tag.
 java.lang.Object visit(ASN1GeneralizedTime value, java.lang.Object object)
          An ASN.1 type GeneralizedTime visit method with value and object parameters.
 java.lang.Object visit(ASN1Integer value, java.lang.Object object)
          An integer value that is not part of a NamedNumberList must be of the format SignedNumber: 0 | -n | n.
 java.lang.Object visit(ASN1ObjectIdentifier value, java.lang.Object object)
          We always encode the value of an OBJECT-IDENTIFIER using the XMLNumberForm ( dot notation ).
 java.lang.Object visit(ASN1OctetString value, java.lang.Object object)
          Print as a string of hex characters.
 java.lang.Object visit(ASN1OpenType value, java.lang.Object object)
          If the OpenType contains a decoded ASN.1 value, then encode the contained value, otherwise assume that the user has provided a correctly encoded value and copy that value into the output stream.
 java.lang.Object visit(ASN1RelativeOID value, java.lang.Object object)
          We always encode the value of an OBJECT-IDENTIFIER using the XMLNumberForm ( dot notation ).
protected  void writeProlog()
          The prolog is required to be absent in the encoding.
 
Methods inherited from class schemajic.encoder.BXEREncoder
encode, printArcs, setUseNamedIntegers, setWriteProlog, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface schemajic.model.ValueVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 

Constructor Detail

CXEREncoder

public CXEREncoder()
Method Detail

createXmlWriter

protected XmlWriter createXmlWriter(java.io.OutputStream out)
Creates a new XML writer for the given output stream.

Overrides:
createXmlWriter in class BXEREncoder
Parameters:
out - an output stream
Returns:
a new XmlWriter

visit

public java.lang.Object visit(ASN1Boolean value,
                              java.lang.Object object)
                       throws VisitorException
The only valid values for a BOOLEAN are 'true' or 'false'.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of an ASN.1 type BOOLEAN in its encoded form
object - visit an object of ASN.1 type BOOLEAN
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1BitString value,
                              java.lang.Object object)
                       throws VisitorException
Encode the bits of the BIT STRING as a string of ones and zeroes with no trailing bits.

Note that only the basic BIT STRING type is supported, and there is no support for NamedBitList values.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of ASN.1 type BIT STRING
object - an Object to visit
Returns:
the null value
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1Choice value,
                              java.lang.Object object)
                       throws VisitorException
Encode the value of the chosen field.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of some ASN.1 CHOICE type in its encoded form
object - visit an object of the ASN.1 CHOICE type
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1Enumerated value,
                              java.lang.Object object)
                       throws VisitorException
Always print the named number as an empty tag.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of ASN.1 type ENUMERATED in its encoded form
object - visit an object of ASN.1 type ENUMERATED
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1GeneralizedTime value,
                              java.lang.Object object)
                       throws VisitorException
Description copied from interface: ValueVisitor
An ASN.1 type GeneralizedTime visit method with value and object parameters.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of ASN.1 type GeneralizedTime in its encoded form
object - visit an object of ASN.1 type GeneralizedTime
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1Integer value,
                              java.lang.Object object)
                       throws VisitorException
An integer value that is not part of a NamedNumberList must be of the format SignedNumber: 0 | -n | n. The minus sign must NOT be present if the value of the Number is 0.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of ASN.1 type INTEGER in its encoded form
object - visit an object of ASN.1 type INTEGER
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1ObjectIdentifier value,
                              java.lang.Object object)
                       throws VisitorException
We always encode the value of an OBJECT-IDENTIFIER using the XMLNumberForm ( dot notation ). i.e.: 1.2.3.4

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of ASN.1 type OBJECT IDENTIFIER in its encoded form
object - visit an object of ASN.1 type OBJECT IDENTIFIER
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1OctetString value,
                              java.lang.Object object)
                       throws VisitorException
Print as a string of hex characters.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of ASN.1 type OCTET STRING in its encoded form
object - visit an object of ASN.1 type OCTET STRING
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1RelativeOID value,
                              java.lang.Object object)
                       throws VisitorException
We always encode the value of an OBJECT-IDENTIFIER using the XMLNumberForm ( dot notation ). i.e.: 1.2.3.4

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of ASN.1 type RELATIVE_OID in its encoded form
object - visit an object of ASN.1 type RELATIVE_OID
Throws:
VisitorException

visit

public java.lang.Object visit(ASN1OpenType value,
                              java.lang.Object object)
                       throws VisitorException
If the OpenType contains a decoded ASN.1 value, then encode the contained value, otherwise assume that the user has provided a correctly encoded value and copy that value into the output stream.

Specified by:
visit in interface ValueVisitor
Overrides:
visit in class BXEREncoder
Parameters:
value - a value of an ASN.1 type in its encoded form (an open type)
object - visit an object of the ASN.1 open type
Throws:
VisitorException

writeProlog

protected void writeProlog()
The prolog is required to be absent in the encoding.

Overrides:
writeProlog in class BXEREncoder

printDefaultValue

protected void printDefaultValue(ASN1Value value,
                                 Field fieldInfo)
                          throws EncodingException
Overrides:
printDefaultValue in class BXEREncoder
Throws:
EncodingException

printArcs

protected void printArcs(int[] arcs)

XCMS Toolkit


Copyright © 2005-2006 GRIFFIN Consulting. All Rights Reserved.