Class CBORParser
java.lang.Object
com.authlete.cbor.CBORParser
A parser that receives CBOR data items (
CBORItem
) from the CBOR
decoder (CBORDecoder
) converts them into instances of common
Java classes.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCBORParser
(byte[] input) A constructor with a byte array that holds CBOR data items.CBORParser
(CBORDecoder decoder) A constructor with a CBOR decoder.CBORParser
(InputStream inputStream) A constructor with an input stream to read CBOR data items from. -
Method Summary
-
Constructor Details
-
CBORParser
public CBORParser(byte[] input) A constructor with a byte array that holds CBOR data items.This constructor is an alias of
CBORParser
(new CBORDecoder(input))
.- Parameters:
input
- A byte array that holds CBOR data items.
-
CBORParser
A constructor with an input stream to read CBOR data items from.This constructor is an alias of
CBORParser
(new CBORDecoder(inputStream))
.- Parameters:
inputStream
- An input stream to read CBOR data items from.
-
CBORParser
A constructor with a CBOR decoder.- Parameters:
decoder
- A CBOR decoder used to decode CBOR data items in the input stream. Must not benull
.
-
-
Method Details
-
next
Get the next CBOR data item from the input stream and convert it into an instance of a common Java class.- Returns:
- An object that represents a CBOR data item. When no more
CBOR data item is available,
null
is returned. - Throws:
IOException
-
all
Read all the CBOR data items from the input stream.- Returns:
- A list of CBOR data items read from the input stream.
- Throws:
IOException
- Since:
- 1.1
-
getDecoder
Get the CBOR decoder used to decode CBOR data items in the input stream.- Returns:
- The CBOR decoder.
-