Package org.webpki.cbor
Class CBORInt
java.lang.Object
org.webpki.cbor.CBORObject
org.webpki.cbor.CBORInt
- All Implemented Interfaces:
Cloneable,Comparable<CBORObject>
Class for holding CBOR
int objects.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.webpki.cbor.CBORObject
checkForUnread, clone, compareTo, encode, equals, getArray, getBigInteger, getBoolean, getBytes, getDateTime, getEpochTime, getExtendedFloat64, getFloat16, getFloat32, getFloat64, getInt16, getInt32, getInt64, getInt8, getMap, getSimple, getString, getTag, getUint16, getUint32, getUint64, getUint8, hashCode, isNull, scan, toDiagnosticNotation, toString
-
Constructor Details
-
CBORInt
public CBORInt(long value, boolean unsigned) Creates a CBOR unsigned or negativeintobject.Unsigned integers range from
0to264-1, while valid negative integers range from-1to-263.See also
CBORBigInt(BigInteger)andCBORObject.getBigInteger().- Parameters:
value- long valueunsigned-trueif value should be considered as unsigned- Throws:
CBORException
-
CBORInt
public CBORInt(long value) Creates a CBOR signedintobject.This constructor is equivalent to
.CBORInt(value, value >= 0)- Parameters:
value- Java (signed) long type
-
CBORIntdoes not support negative integers (CBOR major type 1) beyond the normal range for 64-bit signed integers (-263). In the unlikely case there is a need to explicitly deal with such integers, usingCBORBigIntis the supported workaround.