in protonj2/src/main/java/org/apache/qpid/protonj2/codec/decoders/transport/OpenTypeDecoder.java [79:142]
private Open readOpen(ProtonBuffer buffer, Decoder decoder, DecoderState state, ListTypeDecoder listDecoder) throws DecodeException {
final Open open = new Open();
@SuppressWarnings("unused")
final int size = listDecoder.readSize(buffer, state);
final int count = listDecoder.readCount(buffer, state);
if (count < MIN_OPEN_LIST_ENTRIES) {
throw new DecodeException("The container-id field cannot be omitted from the Open");
}
if (count > MAX_OPEN_LIST_ENTRIES) {
throw new DecodeException("To many entries in Open 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) {
if (index == 0) {
throw new DecodeException("The container-id field cannot be omitted from the Open");
}
buffer.advanceReadOffset(1);
continue;
}
switch (index) {
case 0:
open.setContainerId(decoder.readString(buffer, state));
break;
case 1:
open.setHostname(decoder.readString(buffer, state));
break;
case 2:
open.setMaxFrameSize(decoder.readUnsignedInteger(buffer, state, 0l));
break;
case 3:
open.setChannelMax(decoder.readUnsignedShort(buffer, state, 0));
break;
case 4:
open.setIdleTimeout(decoder.readUnsignedInteger(buffer, state, 0l));
break;
case 5:
open.setOutgoingLocales(decoder.readMultiple(buffer, state, Symbol.class));
break;
case 6:
open.setIncomingLocales(decoder.readMultiple(buffer, state, Symbol.class));
break;
case 7:
open.setOfferedCapabilities(decoder.readMultiple(buffer, state, Symbol.class));
break;
case 8:
open.setDesiredCapabilities(decoder.readMultiple(buffer, state, Symbol.class));
break;
case 9:
open.setProperties(decoder.readMap(buffer, state));
break;
}
}
return open;
}