public void addElement(T element) { super.addItem(element); }
public void setElements(List<T> elements) { super.clear(); for (T ele : elements) { addElement(ele); } }
public static Asn1Type convertAsCollection(Asn1ParseResult parseResult, boolean isLazy) throws IOException { Asn1Collection value = Asn1Collection.createCollection(parseResult.tag()); value.useDefinitiveLength(parseResult.isDefinitiveLength()); value.setLazy(isLazy); Asn1Binder.bind(parseResult, value); return value; }
public static Asn1Collection createCollection(Tag tag) { if (!isCollection(tag)) { throw new IllegalArgumentException("Not collection type, tag: " + tag); } return createCollection(tag.universalTag()); }
public static boolean isCollection(int tag) { return isCollection(new Tag(tag)); }
public static Asn1Collection createCollection(Tag tag) { if (!isCollection(tag)) { throw new IllegalArgumentException("Not collection type, tag: " + tag); } return createCollection(tag.universalTag()); }
public boolean isCollection() { return Asn1Collection.isCollection(tag()); }
public static Asn1Type convertAsCollection(Asn1ParseResult parseResult, boolean isLazy) throws IOException { Asn1Collection value = Asn1Collection.createCollection(parseResult.tag()); value.useDefinitiveLength(parseResult.isDefinitiveLength()); value.setLazy(isLazy); Asn1Binder.bind(parseResult, value); return value; }
/** * Create an ASN1 type with specified tag * @param tagNo The tag number * @return ASN1 type */ public static Asn1Type create(UniversalTag tagNo) { if (Asn1Simple.isSimple(tagNo)) { return Asn1Simple.createSimple(tagNo); } else if (Asn1Collection.isCollection(tagNo)) { return Asn1Collection.createCollection(tagNo); } throw new IllegalArgumentException("Unexpected tag " + tagNo); } }
public static boolean isCollection(Tag tag) { return isCollection(tag.universalTag()); }
public void setElements(List<T> elements) { super.clear(); for (T ele : elements) { addElement(ele); } }
public void addElement(T element) { super.addItem(element); }
/** * Create an ASN1 type with specified tag * @param tagNo The tag number * @return ASN1 type */ public static Asn1Type create(UniversalTag tagNo) { if (Asn1Simple.isSimple(tagNo)) { return Asn1Simple.createSimple(tagNo); } else if (Asn1Collection.isCollection(tagNo)) { return Asn1Collection.createCollection(tagNo); } throw new IllegalArgumentException("Unexpected tag " + tagNo); } }
public boolean isCollection() { return Asn1Collection.isCollection(tag()); }
public static boolean isCollection(Tag tag) { return isCollection(tag.universalTag()); }
public static boolean isCollection(int tag) { return isCollection(new Tag(tag)); }
public static Asn1Collection createCollection(UniversalTag universalTag) { if (!isCollection(universalTag)) { throw new IllegalArgumentException("Not collection type, tag: " + universalTag); } switch (universalTag) { case SEQUENCE: return new Asn1Sequence(); case SEQUENCE_OF: return new Asn1Sequence(); case SET: return new Asn1Set(); case SET_OF: return new Asn1Set(); default: throw new IllegalArgumentException("Unexpected tag " + universalTag.getValue()); } } }
public static Asn1Collection createCollection(UniversalTag universalTag) { if (!isCollection(universalTag)) { throw new IllegalArgumentException("Not collection type, tag: " + universalTag); } switch (universalTag) { case SEQUENCE: return new Asn1Sequence(); case SEQUENCE_OF: return new Asn1Sequence(); case SET: return new Asn1Set(); case SET_OF: return new Asn1Set(); default: throw new IllegalArgumentException("Unexpected tag " + universalTag.getValue()); } } }
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()); } }
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()); } }