private static void decodeSelectors(Interest interest, TlvDecoder decoder, bool copy) { int endOffset = decoder.readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.Selectors); interest.setMinSuffixComponents((int) decoder .readOptionalNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.MinSuffixComponents, endOffset)); interest.setMaxSuffixComponents((int) decoder .readOptionalNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.MaxSuffixComponents, endOffset)); if (decoder.peekType(net.named_data.jndn.encoding.tlv.Tlv.PublisherPublicKeyLocator, endOffset)) decodeKeyLocator(net.named_data.jndn.encoding.tlv.Tlv.PublisherPublicKeyLocator, interest.getKeyLocator(), decoder, copy); else interest.getKeyLocator().clear(); if (decoder.peekType(net.named_data.jndn.encoding.tlv.Tlv.Exclude, endOffset)) decodeExclude(interest.getExclude(), decoder, copy); else interest.getExclude().clear(); interest.setChildSelector((int) decoder .readOptionalNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.ChildSelector, endOffset)); interest.setMustBeFresh(decoder.readBooleanTlv(net.named_data.jndn.encoding.tlv.Tlv.MustBeFresh, endOffset)); decoder.finishNestedTlvs(endOffset); }
private static void decodeExclude(Exclude exclude, TlvDecoder decoder, bool copy) { int endOffset = decoder.readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.Exclude); exclude.clear(); while (decoder.getOffset() < endOffset) { if (decoder.peekType(net.named_data.jndn.encoding.tlv.Tlv.Any, endOffset)) { // Read past the Any TLV. decoder.readBooleanTlv(net.named_data.jndn.encoding.tlv.Tlv.Any, endOffset); exclude.appendAny(); } else exclude.appendComponent(decodeNameComponent(decoder, copy)); } decoder.finishNestedTlvs(endOffset); }