public interface CborNumber
This interface can be used to identify (and provide a uniform set of accessors for) the two
data item types that represent numbers: CborInteger and CborFloat. This helps
make it easier to implement the behavior described in Section 3.6 of RFC7049.
Additionally, the byteValueExact(), shortValueExact(), and intValueExact() methods automatically perform range checks and will throw an ArithmeticException if the underlying value will not fit into the respective primitive type.
CborFloat,
CborInteger| Modifier and Type | Method and Description |
|---|---|
BigInteger |
bigIntegerValue() |
default byte |
byteValueExact()
Returns the value of the integer as a
byte. |
double |
doubleValue()
Returns the value of this data item as a
double. |
float |
floatValue()
Returns the value of this data item as a
float. |
default int |
intValueExact()
Returns the value of the integer as a
int. |
long |
longValue()
Returns the value of the integer as a
long. |
default short |
shortValueExact()
Returns the value of the integer as a
short. |
long longValue()
long. If the underlying value is a floating
point number, then the result is the floor of that value.long value of this object.BigInteger bigIntegerValue()
float floatValue()
float.double doubleValue()
double.default byte byteValueExact()
byte. If the contained value is too large or
too small to fit inside of a byte, a ArithmeticException will be thrown. If
the underlying value is a floating point number, then the result is the floor of that value.byte value of this object.ArithmeticException - if the contained value is too large or too small for a byte.default short shortValueExact()
short. If the contained value is too large or
too small to fit inside of a short, a ArithmeticException will be thrown. If
the underlying value is a floating point number, then the result is the floor of that value.short value of this object.ArithmeticException - if the contained value is too large or too small for a short.default int intValueExact()
int. If the contained value is too large or too
small to fit inside of a int, a If the underlying value is a floating point number,
then the result is the floor of that value. ArithmeticException will be thrown.int value of this object.ArithmeticException - if the contained value is too large or too small for a int.Copyright © 2018–2023. All rights reserved.