@Override protected void decodeBody(Asn1ParseResult parseResult) throws IOException { Asn1Container container = (Asn1Container) parseResult; this.container = container; useDefinitiveLength(parseResult.isDefinitiveLength()); if (!isLazy()) { decodeElements(); } }
public void addItem(Asn1Type value) { resetBodyLength(); getValue().add(value); if (value instanceof Asn1Encodeable) { ((Asn1Encodeable) value).outerEncodeable = this; } }
public Asn1Constructed(Tag tag) { super(tag); setValue(new ArrayList<Asn1Type>()); usePrimitive(false); }
@Override public void dumpWith(Asn1Dumper dumper, int indents) { String typeStr = tag().typeStr() + " [" + "tag=" + tag() + ", len=" + getHeaderLength() + "+" + getBodyLength() + "] "; dumper.indent(indents).append(typeStr).newLine(); List<Asn1Type> items = getValue(); int i = 0; for (Asn1Type aObj : items) { dumper.dumpType(indents + 4, aObj); if (i++ != items.size() - 1) { dumper.newLine(); } } } }
protected void decodeElements() throws IOException { for (Asn1ParseResult parsingItem : getContainer().getChildren()) { if (parsingItem.isEOC()) { continue; } Asn1Type tmpValue = Asn1Converter.convert(parsingItem, lazy); addItem(tmpValue); } }
@Override protected void encodeBody(ByteBuffer buffer) throws IOException { List<Asn1Type> valueItems = getValue(); for (Asn1Type item : valueItems) { if (item != null) { item.encode(buffer); } } }
public static Asn1Type convert(Asn1ParseResult parseResult, boolean isLazy) throws IOException { if (Asn1Simple.isSimple(parseResult.tag())) { return Asn1Converter.convertAsSimple(parseResult); } else if (Asn1Collection.isCollection(parseResult.tag())) { return Asn1Converter.convertAsCollection(parseResult, isLazy); } else if (!parseResult.tag().isPrimitive()) { Asn1Encodeable tmpValue = new Asn1Constructed(parseResult.tag()); tmpValue.decode(parseResult); return tmpValue; } else if (parseResult.isTagSpecific()) { Asn1Specific app = new Asn1Specific(parseResult.tag()); app.decode(parseResult); return app; } else { throw new IOException("Unexpected item: " + parseResult.simpleInfo()); } }
@Override public void dumpWith(Asn1Dumper dumper, int indents) { String typeStr = tag().typeStr() + " [" + "tag=" + tag() + ", len=" + getHeaderLength() + "+" + getBodyLength() + "] "; dumper.indent(indents).append(typeStr).newLine(); List<Asn1Type> items = getValue(); int i = 0; for (Asn1Type aObj : items) { dumper.dumpType(indents + 4, aObj); if (i++ != items.size() - 1) { dumper.newLine(); } } } }
protected void decodeElements() throws IOException { for (Asn1ParseResult parsingItem : getContainer().getChildren()) { if (parsingItem.isEOC()) { continue; } Asn1Type tmpValue = Asn1Converter.convert(parsingItem, lazy); addItem(tmpValue); } }
@Override protected void encodeBody(ByteBuffer buffer) throws IOException { List<Asn1Type> valueItems = getValue(); for (Asn1Type item : valueItems) { if (item != null) { item.encode(buffer); } } }
public static Asn1Type convert(Asn1ParseResult parseResult, boolean isLazy) throws IOException { if (Asn1Simple.isSimple(parseResult.tag())) { return Asn1Converter.convertAsSimple(parseResult); } else if (Asn1Collection.isCollection(parseResult.tag())) { return Asn1Converter.convertAsCollection(parseResult, isLazy); } else if (!parseResult.tag().isPrimitive()) { Asn1Encodeable tmpValue = new Asn1Constructed(parseResult.tag()); tmpValue.decode(parseResult); return tmpValue; } else if (parseResult.isTagSpecific()) { Asn1Specific app = new Asn1Specific(parseResult.tag()); app.decode(parseResult); return app; } else { throw new IOException("Unexpected item: " + parseResult.simpleInfo()); } }
@Override protected void decodeBody(Asn1ParseResult parseResult) throws IOException { Asn1Container container = (Asn1Container) parseResult; this.container = container; useDefinitiveLength(parseResult.isDefinitiveLength()); if (!isLazy()) { decodeElements(); } }
public void addItem(Asn1Type value) { resetBodyLength(); getValue().add(value); if (value instanceof Asn1Encodeable) { ((Asn1Encodeable) value).outerEncodeable = this; } }
public Asn1Constructed(Tag tag) { super(tag); setValue(new ArrayList<Asn1Type>()); usePrimitive(false); }
@Override protected int encodingBodyLength() throws IOException { List<Asn1Type> valueItems = getValue(); int allLen = 0; for (Asn1Type item : valueItems) { if (item != null) { allLen += item.encodingLength(); } } return allLen; }
public void clear() { resetBodyLength(); getValue().clear(); }
@Override protected int encodingBodyLength() throws IOException { List<Asn1Type> valueItems = getValue(); int allLen = 0; for (Asn1Type item : valueItems) { if (item != null) { allLen += item.encodingLength(); } } return allLen; }
public void clear() { resetBodyLength(); getValue().clear(); }
private void blindlyDecode() throws IOException { Asn1Type anyValue = Asn1Converter.convert(parseResult, false); if (decodeInfo != null && decodeInfo.isTagged()) { // Escape the wrapper Asn1Constructed constructed = (Asn1Constructed) anyValue; Asn1Type innerValue = constructed.getValue().get(0); setValue(innerValue); } else { setValue(anyValue); } isBlindlyDecoded = true; }
private void blindlyDecode() throws IOException { Asn1Type anyValue = Asn1Converter.convert(parseResult, false); if (decodeInfo != null && decodeInfo.isTagged()) { // Escape the wrapper Asn1Constructed constructed = (Asn1Constructed) anyValue; Asn1Type innerValue = constructed.getValue().get(0); setValue(innerValue); } else { setValue(anyValue); } isBlindlyDecoded = true; }