Package com.oss.asn1

Class EncodingRuleConvertor

java.lang.Object
com.oss.asn1.Coder
com.oss.asn1.EncodingRuleConvertor
Direct Known Subclasses:
Binary2JSONConvertor, Binary2XMLConvertor, JSON2BinaryConvertor, XML2BinaryConvertor

public class EncodingRuleConvertor extends Coder
The EncodingRuleConvertor is used to decode input stream encoded by input encoding rules and re-encode it using output encoding rules. The EncodingRuleConvertor performs the conversion using two Coder objects: decoder and encoder.
Since:
ASN.1/Java 6.2
  • Constructor Details

    • EncodingRuleConvertor

      public EncodingRuleConvertor(Coder decoder, Coder encoder)
      Construct with two coder objects
      Parameters:
      decoder - input decoder
      encoder - output encoder
  • Method Details

    • getDecoder

      public Coder getDecoder()
      Returns decoder object that is used to decode the input stream
      Returns:
      input decoder
    • setDecoder

      public void setDecoder(Coder decoder)
      Set decoder object that will be used to decode the input stream
      Parameters:
      decoder - input decoder
    • getEncoder

      public Coder getEncoder()
      Returns encoder object that is used to re-encode to the output stream
      Returns:
      output encoder
    • setEncoder

      public void setEncoder(Coder encoder)
      Set encoder object that will be used to re-encode to the output stream
      Parameters:
      encoder - output encoder
    • convert

      public final void convert(InputStream source, OutputStream sink, AbstractData pdu) throws DecodeFailedException, EncodeFailedException
      Decode the "source" stream, containing the "pdu" value and re-encode it into the "sink" stream. If PDU detection is available for the input coder object, then the "pdu" parameter can be set to null.
      Parameters:
      source - input stream
      sink - output stream .
      pdu - the PDU instance that will receive the decoded data. If PDU detection is available for the input coder object, then the parameter can be set to null.
      Throws:
      DecodeFailedException - thrown if the decode operation fails.
      EncodeFailedException - thrown if the encode operation fails.
    • getTransferSyntax

      public TransferSyntax getTransferSyntax()
      Specified by:
      getTransferSyntax in class Coder
      Returns:
      identifier of this coder encoding rules.