Package com.oss.asn1
Class EncodingRuleConvertor
java.lang.Object
com.oss.asn1.Coder
com.oss.asn1.EncodingRuleConvertor
- Direct Known Subclasses:
Binary2XMLConvertor
,XML2BinaryConvertor
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 Summary
ConstructorsConstructorDescriptionEncodingRuleConvertor
(Coder decoder, Coder encoder) Construct with two coder objects -
Method Summary
Modifier and TypeMethodDescriptionfinal void
convert
(InputStream source, OutputStream sink, AbstractData pdu) Decode the "source" stream, containing the "pdu" value and re-encode it into the "sink" stream.Returns decoder object that is used to decode the input streamReturns encoder object that is used to re-encode to the output streamvoid
setDecoder
(Coder decoder) Set decoder object that will be used to decode the input streamvoid
setEncoder
(Coder encoder) Set encoder object that will be used to re-encode to the output streamMethods inherited from class com.oss.asn1.Coder
decode, decode, decodePartial, decodePartial, disableAutomaticDecoding, disableAutomaticEncoding, disableCompact, disableContainedValueDecoding, disableContainedValueEncoding, disableDecoderConstraints, disableDecoderDebugging, disableDeferredDecoding, disableEncoderConstraints, disableEncoderDebugging, disableEncodingOfAbsentComponents, disableEncodinOfImpliedValues, disableRelaxedDecoding, disableRichDecoderExceptions, disableStrictDecoding, disableTruncatedZeroSecondsInGeneralizedTime, disableTruncatedZeroSecondsInUTCTime, disableXERCoderInterface, enableAutomaticDecoding, enableAutomaticEncoding, enableCompact, enableContainedValueDecoding, enableContainedValueDecoding, enableContainedValueEncoding, enableDecoderConstraints, enableDecoderDebugging, enableDeferredDecoding, enableEncoderConstraints, enableEncoderDebugging, enableEncodingOfAbsentComponents, enableEncodingOfImpliedValues, enableRelaxedDecoding, enableRichDecoderExceptions, enableStrictDecoding, enableTruncatedZeroSecondsInGeneralizedTime, enableTruncatedZeroSecondsInUTCTime, enableXERCoderInterface, encode, encode, encode, excludeXMLDeclaration, getDecoderDebugOut, getDecoderDebugProperties, getEncoderDebugOut, getEncoderDebugProperties, getIndentWidth, getNumberOfPaddingBits, includeXMLDeclaration, isPDUDetectionAvailable, setDecoderDebugOut, setDecoderDebugProperties, setEncoderDebugOut, setEncoderDebugProperties, setIndentWidth, toString, useDefiniteLengthEncoding, useIndefiniteLengthEncoding, usingDefiniteLengthEncoding, validate
-
Constructor Details
-
EncodingRuleConvertor
Construct with two coder objects- Parameters:
decoder
- input decoderencoder
- output encoder
-
-
Method Details
-
getDecoder
Returns decoder object that is used to decode the input stream- Returns:
- input decoder
-
setDecoder
Set decoder object that will be used to decode the input stream- Parameters:
decoder
- input decoder
-
getEncoder
Returns encoder object that is used to re-encode to the output stream- Returns:
- output encoder
-
setEncoder
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 streamsink
- 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.
-