Package com.oss.util
Class BERTool.BERReader
java.lang.Object
com.oss.util.BERTool.BERReader
- Enclosing class:
- BERTool
Provides the readTLV() method to read a complete BER encoding from an
input stream and return it as an array of bytes.
The class instance uses an internal byte buffer to acquire encoded bytes that are read from the input stream. The buffer is allocated with a default or specified size and is resized as needed to acquire the longest BER encoding across multiple invocations of the readTLV() method.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
readTLV
(InputStream in) Reads a complete BER encoding from an input stream and returns it as an array of bytes.
-
Constructor Details
-
BERReader
public BERReader()Constructs an instance with a default initial buffer size. -
BERReader
public BERReader(int size) Constructs an instance with a specified initial buffer size.- Parameters:
size
- the initial size of the internal buffer that is used to acquire a BER encoding.
-
-
Method Details
-
readTLV
Reads a complete BER encoding from an input stream and returns it as an array of bytes.- Parameters:
in
- the input stream.- Returns:
- the byte array containing a complete BER/DER/CER encoding.
- Throws:
IOException
- when an input error occurs.BERTool.BERException
- when an error in the BER data is detected.
-