dataItem = decoder.decodeNext();
MajorType majorType = dataItem.getMajorType();
if (Special.BREAK.equals(dataItem)) {
break;
} else if (majorType == MajorType.BYTE_STRING) {
ByteString byteString = (ByteString) dataItem;
try {
bytes.write(byteString.getBytes());
} catch (IOException ioException) {
throw new CborException(ioException);
}
} else {
throw new CborException("Unexpected major type "
+ majorType);
}
}
return new ByteString(bytes.toByteArray());
}