public static int asNumber()

in java/cose/CborUtil.java [92:100]


  public static int asNumber(DataItem dataItem) throws CborException {
    if (dataItem.getMajorType() == MajorType.UNSIGNED_INTEGER) {
      return ((UnsignedInteger) dataItem).getValue().intValue();
    } else if (dataItem.getMajorType() == MajorType.NEGATIVE_INTEGER) {
      return ((NegativeInteger) dataItem).getValue().intValue();
    } else {
      throw new CborException(String.format("Invalid type: %s", dataItem.getMajorType()));
    }
  }