Class CBORDecoder
java.lang.Object
com.authlete.cbor.CBORDecoder
A decoder that receives CBOR tokens (
CBORToken
) from the CBOR
tokenizer (CBORTokenizer
) and constructs CBOR data items
(CBORItem
).- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCBORDecoder
(byte[] input) A constructor with a byte array that holds CBOR data items.CBORDecoder
(byte[] input, int offset, int length) A constructor with a byte array that holds CBOR data items.CBORDecoder
(byte[] input, int offset, int length, CBORDecoderOptions options) A constructor with a byte array that holds CBOR data items and options to control the behavior of this decoder.CBORDecoder
(byte[] input, CBORDecoderOptions options) A constructor with a byte array that holds CBOR data items and options to control the behavior of this decoder.CBORDecoder
(InputStream inputStream) A constructor with an input stream to read CBOR data items from.CBORDecoder
(InputStream inputStream, CBORDecoderOptions options) A constructor with an input stream to read CBOR data items from and options to control the behavior of this decoder. -
Method Summary
-
Constructor Details
-
CBORDecoder
public CBORDecoder(byte[] input) A constructor with a byte array that holds CBOR data items.This constructor is an alias of
CBORDecoder
(input, null)
.- Parameters:
input
- A byte array that holds CBOR data items.
-
CBORDecoder
A constructor with a byte array that holds CBOR data items and options to control the behavior of this decoder.This constructor is an alias of
CBORDecoder
(new ByteArrayInputStream(input), options)
.- Parameters:
input
- A byte array that holds CBOR data items.options
- Options to control the behavior of this decoder.
-
CBORDecoder
public CBORDecoder(byte[] input, int offset, int length) A constructor with a byte array that holds CBOR data items.This constructor is an alias of
CBORDecoder
(input, offset, length, null)
.- Parameters:
input
- A byte array that holds CBOR data items.offset
- The offset in the byte array of the first byte to read.length
- The maximum number of bytes to read from the byte array.
-
CBORDecoder
A constructor with a byte array that holds CBOR data items and options to control the behavior of this decoder.This constructor is an alias of
CBORDecoder
(new ByteArrayInputStream(input, offset, length), options)
.- Parameters:
input
- A byte array that holds CBOR data items.offset
- The offset in the byte array of the first byte to read.length
- The maximum number of bytes to read from the byte array.options
- Options to control the behavior of this decoder.
-
CBORDecoder
A constructor with an input stream to read CBOR data items from.This constructor is an alias of
CBORDecoder
(inputStream, null)
.- Parameters:
inputStream
- An input stream to read CBOR data items from.
-
CBORDecoder
A constructor with an input stream to read CBOR data items from and options to control the behavior of this decoder.- Parameters:
inputStream
- An input stream to read CBOR data items from.options
- Options to control the behavior of this decoder. Ifnull
is given, an instance ofCBORDefaultDecoderOptions
is created and used.
-
-
Method Details
-
getOptions
Get the options for this decoder.- Returns:
- The options for this decoder.
-
next
Get the next CBOR data item from the input stream.- Returns:
- 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
-