dataItem = decoder.decodeNext();
MajorType majorType = dataItem.getMajorType();
if (Special.BREAK.equals(dataItem)) {
break;
} else if (majorType == MajorType.UNICODE_STRING) {
UnicodeString unicodeString = (UnicodeString) dataItem;
try {
bytes.write(unicodeString.toString().getBytes(UTF8));
} catch (IOException ioException) {
throw new CborException(ioException);
}
} else {
throw new CborException("Unexpected major type " + majorType);
}
}
return new UnicodeString(new String(bytes.toByteArray(), UTF8));
}