Package com.oss.asn1
Class Binary2CSVConvertor
java.lang.Object
com.oss.asn1.Binary2CSVConvertor
The BinaryToCSVConvertor is used to convert a binary data encoded with one
of the Binary Encoding Rules into CSV format in one step.
- Since:
- ASN.1/Java 8.5
-
Constructor Summary
ConstructorDescriptionBinary2CSVConvertor
(BinaryCoder decoder, CSVTool encoder) Constructs the converter with the binary coder and the CSV printer objects. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
convert
(InputStream source, PrintWriter sink, AbstractData pdu) Decodes thesource
stream, containing thepdu
value, and prints the decoded value in the CSV format to thesink
output stream.Returns the decoder that is used to decode the input stream.Returns the CSV printer object that is used to print the binary encoding in the CSV format.void
setDecoder
(BinaryCoder decoder) Sets the binary decoder.void
setEncoder
(CSVTool encoder) Sets output CSV printer.
-
Constructor Details
-
Binary2CSVConvertor
Constructs the converter with the binary coder and the CSV printer objects.- Parameters:
decoder
- input binary decoder.encoder
- output CSV printer.
-
-
Method Details
-
getDecoder
Returns the decoder that is used to decode the input stream.- Returns:
- input decoder.
-
setDecoder
Sets the binary decoder.- Parameters:
decoder
- input binary decoder.
-
getEncoder
Returns the CSV printer object that is used to print the binary encoding in the CSV format.- Returns:
- CSV printer object.
-
setEncoder
Sets output CSV printer.- Parameters:
encoder
- output CSV printer.
-
convert
public final void convert(InputStream source, PrintWriter sink, AbstractData pdu) throws DecodeFailedException, CSVPrintFailedException Decodes thesource
stream, containing thepdu
value, and prints the decoded value in the CSV format to thesink
output stream. If pdu detection is available for the input coder object, then thepdu
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.CSVPrintFailedException
- thrown if the decoded value cannot be printed in CSV format due to an error.
-