# Class: com.pnfsoftware.jeb.util.encoding.cbor.CborDecoder

Provides a decoder capable of handling CBOR encoded data from a [InputStream](InputStream).

## Constructor: CborDecoder
- parameter: `is`, type: `java.io.InputStream`

Description: Creates a new [CborDecoder](CborDecoder) instance.
parameter: is: the actual input stream to read the CBOR\-encoded data from, cannot be `null`.

## Protected Field: m_is
Type: `java.io.PushbackInputStream`

## Protected Method: expectIntegerType
- parameter: `ib`, type: `int`
- return type: `long`

Description: Reads the next major type from the underlying input stream, and verifies whether it matches the given expectation.
parameter: majorType: the expected major type, cannot be `null` \(unchecked\).
return: either `-1` if the major type was an signed integer, or `0` otherwise.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: peekType
- return type: `com.pnfsoftware.jeb.util.encoding.cbor.CborType`

Description: Peeks in the input stream for the upcoming type.
return: the upcoming type in the stream, or `null` in case of an end\-of\-stream.
throws: in case of I/O problems reading the CBOR\-type from the underlying input stream.

## Method: readArrayLength
- return type: `long`

Description: Prolog to reading an array value in CBOR format.
return: the number of elements in the array to read, or `-1` in case of infinite\-length arrays.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readBoolean
- return type: `boolean`

Description: Reads a boolean value in CBOR format.
return: the read boolean.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readBreak
- return type: `java.lang.Object`

Description: Reads a "break"/stop value in CBOR format.
return: always `null`.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readByteString
- return type: `byte[]`

Description: Reads a byte string value in CBOR format.
return: the read byte string, never `null`. In case the encoded string has a length of `0`, an empty string is returned.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readByteStringLength
- return type: `long`

Description: Prolog to reading a byte string value in CBOR format.
return: the number of bytes in the string to read, or `-1` in case of infinite\-length strings.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readDouble
- return type: `double`

Description: Reads a double\-precision float value in CBOR format.
return: the read double value, values from [Float#MIN_VALUE](Float#MIN_VALUE) to [Float#MAX_VALUE](Float#MAX_VALUE) are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readFloat
- return type: `float`

Description: Reads a single\-precision float value in CBOR format.
return: the read float value, values from [Float#MIN_VALUE](Float#MIN_VALUE) to [Float#MAX_VALUE](Float#MAX_VALUE) are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readHalfPrecisionFloat
- return type: `double`

Description: Reads a half\-precision float value in CBOR format.
return: the read half\-precision float value, values from [Float#MIN_VALUE](Float#MIN_VALUE) to [Float#MAX_VALUE](Float#MAX_VALUE) are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readInt
- return type: `long`

Description: Reads a signed or unsigned integer value in CBOR format.
return: the read integer value, values from [Long#MIN_VALUE](Long#MIN_VALUE) to [Long#MAX_VALUE](Long#MAX_VALUE) are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readInt16
- return type: `int`

Description: Reads a signed or unsigned 16\-bit integer value in CBOR format.
return: the small integer value, values from `[-65536..65535]` are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying output stream.

## Method: readInt32
- return type: `long`

Description: Reads a signed or unsigned 32\-bit integer value in CBOR format.
return: the small integer value, values in the range `[-4294967296..4294967295]` are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying output stream.

## Method: readInt64
- return type: `long`

Description: Reads a signed or unsigned 64\-bit integer value in CBOR format.
return: the small integer value, values from [Long#MIN_VALUE](Long#MIN_VALUE) to [Long#MAX_VALUE](Long#MAX_VALUE) are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying output stream.

## Method: readInt8
- return type: `int`

Description: Reads a signed or unsigned 8\-bit integer value in CBOR format.
return: the small integer value, values in the range `[-256..255]` are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying output stream.

## Protected Method: readMajorType
- parameter: `majorType`, type: `int`
- return type: `int`

Description: Reads the next major type from the underlying input stream, and verifies whether it matches the given expectation.
parameter: majorType: the expected major type, cannot be `null` \(unchecked\).
return: the read subtype, or payload, of the read major type.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Protected Method: readMajorTypeExact
- parameter: `majorType`, type: `int`
- parameter: `subtype`, type: `int`

Description: Reads the next major type from the underlying input stream, and verifies whether it matches the given expectations.
parameter: majorType: the expected major type, cannot be `null` \(unchecked\);
parameter: subtype: the expected subtype.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Protected Method: readMajorTypeWithSize
- parameter: `majorType`, type: `int`
- return type: `long`

Description: Reads the next major type from the underlying input stream, verifies whether it matches the given expectation, and decodes the payload into a size.
parameter: majorType: the expected major type, cannot be `null` \(unchecked\).
return: the number of succeeding bytes, \>= 0, or `-1` if an infinite\-length type is read.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readMapLength
- return type: `long`

Description: Prolog to reading a map of key\-value pairs in CBOR format.
return: the number of entries in the map, \>= 0.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readNull
- return type: `java.lang.Object`

Description: Reads a `null`\-value in CBOR format.
return: always `null`.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readSimpleValue
- return type: `byte`

Description: Reads a single byte value in CBOR format.
return: the read byte value.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readSmallInt
- return type: `int`

Description: Reads a signed or unsigned small \(<= 23\) integer value in CBOR format.
return: the small integer value, values in the range `[-24..23]` are supported.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying output stream.

## Method: readTag
- return type: `long`

Description: Reads a semantic tag value in CBOR format.
return: the read tag value.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readTextString
- return type: `java.lang.String`

Description: Reads an UTF\-8 encoded string value in CBOR format.
return: the read UTF\-8 encoded string, never `null`. In case the encoded string has a length of `0`, an empty string is returned.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Method: readTextStringLength
- return type: `long`

Description: Prolog to reading an UTF\-8 encoded string value in CBOR format.
return: the length of the string to read, or `-1` in case of infinite\-length strings.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

## Protected Method: readUInt
- parameter: `length`, type: `int`
- parameter: `breakAllowed`, type: `boolean`
- return type: `long`

Description: Reads an unsigned integer with a given length\-indicator.
parameter: length: the length indicator to use;
return: the read unsigned integer, as long value.
throws: in case of I/O problems reading the unsigned integer from the underlying input stream.

## Protected Method: readUInt16
- return type: `int`

Description: Reads an unsigned 16\-bit integer value
return: value the read value, values from [Long#MIN_VALUE](Long#MIN_VALUE) to [Long#MAX_VALUE](Long#MAX_VALUE) are supported.
throws: in case of I/O problems writing the CBOR\-encoded value to the underlying output stream.

## Protected Method: readUInt32
- return type: `long`

Description: Reads an unsigned 32\-bit integer value
return: value the read value, values from [Long#MIN_VALUE](Long#MIN_VALUE) to [Long#MAX_VALUE](Long#MAX_VALUE) are supported.
throws: in case of I/O problems writing the CBOR\-encoded value to the underlying output stream.

## Protected Method: readUInt64
- return type: `long`

Description: Reads an unsigned 64\-bit integer value
return: value the read value, values from [Long#MIN_VALUE](Long#MIN_VALUE) to [Long#MAX_VALUE](Long#MAX_VALUE) are supported.
throws: in case of I/O problems writing the CBOR\-encoded value to the underlying output stream.

## Protected Method: readUInt8
- return type: `int`

Description: Reads an unsigned 8\-bit integer value
return: value the read value, values from [Long#MIN_VALUE](Long#MIN_VALUE) to [Long#MAX_VALUE](Long#MAX_VALUE) are supported.
throws: in case of I/O problems writing the CBOR\-encoded value to the underlying output stream.

## Protected Method: readUIntExact
- parameter: `expectedLength`, type: `int`
- parameter: `length`, type: `int`
- return type: `long`

Description: Reads an unsigned integer with a given length\-indicator.
parameter: length: the length indicator to use;
return: the read unsigned integer, as long value.
throws: in case of I/O problems reading the unsigned integer from the underlying input stream.

## Method: readUndefined
- return type: `java.lang.Object`

Description: Reads an undefined value in CBOR format.
return: always `null`.
throws: in case of I/O problems reading the CBOR\-encoded value from the underlying input stream.

