1.添加依赖

	<dependency>
            <groupId>co.nstant.in</groupId>
            <artifactId>cbor</artifactId>
            <version>0.9</version>
        </dependency>

2.将数据转为byte数组并解码

    byte[] decodedMessage = { 0x78, (byte)0x9c, 0x5b, (byte)0xe4, 0x58, 0x10} 
    ByteArrayInputStream bais = new ByteArrayInputStream(decodedMessage); 
    List<DataItem> dataItems = new CborDecoder(bais).decode(); 
    for (DataItem dataItem : dataItems) { 
    System.out.println("the type of this dataItem is " + dataItem.getMajorType()); 
    switch(dataItem.getMajorType()) { 
     UNSIGNED_INTEGER: 
      UnsignedInteger unsignedInteger = (UnsignedInteger) dataItem; 
      System.out.println("the value of this dataItem is " + unsigendInteger.getValue()); 
     default: 
      System.out.println("unknown type: " + dataItem.getMajorType()); 
    } 
} 

参考文档:
Java - 如何解码CBOR编码的byte []数组