in protonj2/src/main/java/org/apache/qpid/protonj2/codec/decoders/messaging/PropertiesTypeDecoder.java [78:147]
private Properties readProperties(ProtonBuffer buffer, DecoderState state, ListTypeDecoder listDecoder) throws DecodeException {
final Properties properties = new Properties();
@SuppressWarnings("unused")
final int size = listDecoder.readSize(buffer, state);
final int count = listDecoder.readCount(buffer, state);
// Don't decode anything if things already look wrong.
if (count < MIN_PROPERTIES_LIST_ENTRIES) {
throw new DecodeException("Not enough entries in Properties list encoding: " + count);
}
if (count > MAX_PROPERTIES_LIST_ENTRIES) {
throw new DecodeException("To many entries in Properties list encoding: " + count);
}
for (int index = 0; index < count; ++index) {
// Peek ahead and see if there is a null in the next slot, if so we don't call
// the setter for that entry to ensure the returned type reflects the encoded
// state in the modification entry.
if (buffer.peekByte() == EncodingCodes.NULL) {
buffer.advanceReadOffset(1);
continue;
}
switch (index) {
case 0:
properties.setMessageId(state.getDecoder().readObject(buffer, state));
break;
case 1:
properties.setUserId(state.getDecoder().readBinary(buffer, state));
break;
case 2:
properties.setTo(state.getDecoder().readString(buffer, state));
break;
case 3:
properties.setSubject(state.getDecoder().readString(buffer, state));
break;
case 4:
properties.setReplyTo(state.getDecoder().readString(buffer, state));
break;
case 5:
properties.setCorrelationId(state.getDecoder().readObject(buffer, state));
break;
case 6:
properties.setContentType(state.getDecoder().readSymbol(buffer, state, null));
break;
case 7:
properties.setContentEncoding(state.getDecoder().readSymbol(buffer, state, null));
break;
case 8:
properties.setAbsoluteExpiryTime(state.getDecoder().readTimestamp(buffer, state, 0l));
break;
case 9:
properties.setCreationTime(state.getDecoder().readTimestamp(buffer, state, 0l));
break;
case 10:
properties.setGroupId(state.getDecoder().readString(buffer, state));
break;
case 11:
properties.setGroupSequence(state.getDecoder().readUnsignedInteger(buffer, state, 0l));
break;
case 12:
properties.setReplyToGroupId(state.getDecoder().readString(buffer, state));
break;
}
}
return properties;
}