use of org.apache.qpid.protonj2.codec.decoders.primitives.NullTypeDecoder in project qpid-protonj2 by apache.
the class ApplicationPropertiesTypeDecoder method readArrayElements.
@Override
public ApplicationProperties[] readArrayElements(InputStream stream, StreamDecoderState state, int count) throws DecodeException {
final StreamTypeDecoder<?> decoder = state.getDecoder().readNextTypeDecoder(stream, state);
final ApplicationProperties[] result = new ApplicationProperties[count];
if (decoder instanceof NullTypeDecoder) {
for (int i = 0; i < count; ++i) {
result[i] = new ApplicationProperties(null);
}
return result;
}
for (int i = 0; i < count; ++i) {
result[i] = new ApplicationProperties(readMap(stream, state, checkIsExpectedTypeAndCast(MapTypeDecoder.class, decoder)));
}
return result;
}
use of org.apache.qpid.protonj2.codec.decoders.primitives.NullTypeDecoder in project qpid-protonj2 by apache.
the class DeliveryAnnotationsTypeDecoder method readArrayElements.
@Override
public DeliveryAnnotations[] readArrayElements(ProtonBuffer buffer, DecoderState state, int count) throws DecodeException {
final TypeDecoder<?> decoder = state.getDecoder().readNextTypeDecoder(buffer, state);
final DeliveryAnnotations[] result = new DeliveryAnnotations[count];
if (decoder instanceof NullTypeDecoder) {
for (int i = 0; i < count; ++i) {
decoder.readValue(buffer, state);
result[i] = new DeliveryAnnotations(null);
}
return result;
}
for (int i = 0; i < count; ++i) {
result[i] = new DeliveryAnnotations(readMap(buffer, state, checkIsExpectedTypeAndCast(MapTypeDecoder.class, decoder)));
}
return result;
}
use of org.apache.qpid.protonj2.codec.decoders.primitives.NullTypeDecoder in project qpid-protonj2 by apache.
the class DeliveryAnnotationsTypeDecoder method readArrayElements.
@Override
public DeliveryAnnotations[] readArrayElements(InputStream stream, StreamDecoderState state, int count) throws DecodeException {
final StreamTypeDecoder<?> decoder = state.getDecoder().readNextTypeDecoder(stream, state);
final DeliveryAnnotations[] result = new DeliveryAnnotations[count];
if (decoder instanceof NullTypeDecoder) {
for (int i = 0; i < count; ++i) {
decoder.readValue(stream, state);
result[i] = new DeliveryAnnotations(null);
}
return result;
}
for (int i = 0; i < count; ++i) {
result[i] = new DeliveryAnnotations(readMap(stream, state, checkIsExpectedTypeAndCast(MapTypeDecoder.class, decoder)));
}
return result;
}
use of org.apache.qpid.protonj2.codec.decoders.primitives.NullTypeDecoder in project qpid-protonj2 by apache.
the class FooterTypeDecoder method readArrayElements.
@SuppressWarnings("unchecked")
@Override
public Footer[] readArrayElements(InputStream stream, StreamDecoderState state, int count) throws DecodeException {
final StreamTypeDecoder<?> decoder = state.getDecoder().readNextTypeDecoder(stream, state);
final Footer[] result = new Footer[count];
if (decoder instanceof NullTypeDecoder) {
for (int i = 0; i < count; ++i) {
decoder.readValue(stream, state);
result[i] = new Footer(null);
}
return result;
}
final MapTypeDecoder mapDecoder = checkIsExpectedTypeAndCast(MapTypeDecoder.class, decoder);
for (int i = 0; i < count; ++i) {
result[i] = new Footer(mapDecoder.readValue(stream, state));
}
return result;
}
use of org.apache.qpid.protonj2.codec.decoders.primitives.NullTypeDecoder in project qpid-protonj2 by apache.
the class ApplicationPropertiesTypeDecoder method readArrayElements.
@Override
public ApplicationProperties[] readArrayElements(ProtonBuffer buffer, DecoderState state, int count) throws DecodeException {
final TypeDecoder<?> decoder = state.getDecoder().readNextTypeDecoder(buffer, state);
final ApplicationProperties[] result = new ApplicationProperties[count];
if (decoder instanceof NullTypeDecoder) {
for (int i = 0; i < count; ++i) {
result[i] = new ApplicationProperties(null);
}
return result;
}
for (int i = 0; i < count; ++i) {
result[i] = new ApplicationProperties(readMap(buffer, state, checkIsExpectedTypeAndCast(MapTypeDecoder.class, decoder)));
}
return result;
}
Aggregations