public class CborType
extends java.lang.Object
The major type is encoded in the upper three bits of each initial byte. The lower 5 bytes represent any additional information.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getAdditionalInfo() |
int |
getMajorType() |
static java.lang.String |
getName(int mt)
Returns a descriptive string for the given major type.
|
int |
hashCode() |
boolean |
isBreakAllowed() |
boolean |
isEqualType(CborType other)
|
boolean |
isEqualType(int encoded)
|
java.lang.String |
toString() |
static CborType |
valueOf(int i)
Decodes a given byte value to a
CborType value. |
public static java.lang.String getName(int mt) throws java.lang.IllegalArgumentException
mt
- the major type to return as string, values from [0..7] are supported.null
.java.lang.IllegalArgumentException
- in case the given major type is not supported.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int getAdditionalInfo()
public int getMajorType()
public int hashCode()
hashCode
in class java.lang.Object
public boolean isBreakAllowed()
true
if this type allows for an infinite-length payload,
false
if only definite-length payloads are allowed.public boolean isEqualType(CborType other) throws java.lang.IllegalArgumentException
public boolean isEqualType(int encoded)
CborType
) equals the major type of this CborType
.encoded
- the encoded CBOR type to compare.true
if the given byte value represents the same major type as this CborType
, false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object