// LOG.debug("optionLength : {}", optionLength);
// create the option DTO
CoapOptionType optType = CoapOptionType.fromCode(optionCode);
if (optType == null) {
throw new ProtocolDecoderException("unknown option code : " + optionCode);
}
// LOG.debug("option type : {}", optType);
// get the value
byte[] optionValue = new byte[optionLength];
input.get(optionValue);
options.add(new CoapOption(optType, optionValue));
;
}
}
if (input.hasRemaining()) {
throw new ProtocolDecoderException("trailling " + input.remaining() + " bytes in the UDP datagram");
}
return new CoapMessage(version, type, code, id, token, options.toArray(EMPTY_OPTION), payload);
}