protected void setFieldAsAny(EnumType index, Asn1Type value) { if (value != null) { Asn1Any any = new Asn1Any(value); any.setDecodeInfo(fieldInfos[index.getValue()]); setFieldAs(index, any); } }
@Override protected void decodeBody(Asn1ParseResult parseResult) throws IOException { this.parseResult = parseResult; if (valueType != null) { typeAwareDecode(valueType); } else { blindlyDecode(); } }
@Override public void decode(Asn1ParseResult parseResult) throws IOException { // Avoid the tag checking here. decodeBody(parseResult); }
protected <T extends Asn1Type> T getValueAs(Class<T> t) { Asn1Type value = getValue(); if (value != null && !isBlindlyDecoded) { return (T) value; } if (valueType != null && valueType != t) { throw new RuntimeException("Required value type isn't the same" + " with the value type set before"); } try { typeAwareDecode(t); } catch (IOException e) { throw new RuntimeException("Type aware decoding of Any type failed"); } return (T) getValue(); }
@Override protected int encodingBodyLength() { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue == null) { return 0; } return -1; // Indicate error, shouldn't be here. }
public Asn1Any(Asn1Type anyValue) { this(); setValue(anyValue); }
protected void setAnyFieldValueType(EnumType index, Class<? extends Asn1Type> valueType) { if (valueType != null) { checkAndInitField(index.getValue()); Asn1Type value = fields[index.getValue()]; if (value != null && value instanceof Asn1Any) { Asn1Any any = (Asn1Any) value; any.setValueType(valueType); } } }
protected <T extends Asn1Type> T getFieldAsAny(EnumType index, Class<T> t) { Asn1Type value = fields[index.getValue()]; if (value != null && value instanceof Asn1Any) { Asn1Any any = (Asn1Any) value; return any.getValueAs(t); } return null; }
private void attemptBinding(Asn1ParseResult parseItem, int foundPos) throws IOException { Asn1FieldInfo fieldInfo = fieldInfos[foundPos]; checkAndInitField(foundPos); Asn1Type fieldValue = fields[foundPos]; if (fieldValue instanceof Asn1Any) { Asn1Any any = (Asn1Any) fieldValue; any.setDecodeInfo(fieldInfo); Asn1Binder.bind(parseItem, any); } else { if (parseItem.isContextSpecific()) { Asn1Binder.bindWithTagging(parseItem, fieldValue, fieldInfo.getTaggingOption()); } else { Asn1Binder.bind(parseItem, fieldValue); } } }
@Override protected int encodingBodyLength() { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue == null) { return 0; } return -1; // Indicate error, shouldn't be here. }
public Asn1Any(Asn1Type anyValue) { this(); setValue(anyValue); }
protected <T extends Asn1Type> T getValueAs(Class<T> t) { Asn1Type value = getValue(); if (value != null && !isBlindlyDecoded) { return (T) value; } if (valueType != null && valueType != t) { throw new RuntimeException("Required value type isn't the same" + " with the value type set before"); } try { typeAwareDecode(t); } catch (IOException e) { throw new RuntimeException("Type aware decoding of Any type failed"); } return (T) getValue(); }
protected void setAnyFieldValueType(EnumType index, Class<? extends Asn1Type> valueType) { if (valueType != null) { checkAndInitField(index.getValue()); Asn1Type value = fields[index.getValue()]; if (value != null && value instanceof Asn1Any) { Asn1Any any = (Asn1Any) value; any.setValueType(valueType); } } }
protected <T extends Asn1Type> T getFieldAsAny(EnumType index, Class<T> t) { Asn1Type value = fields[index.getValue()]; if (value != null && value instanceof Asn1Any) { Asn1Any any = (Asn1Any) value; return any.getValueAs(t); } return null; }
private void attemptBinding(Asn1ParseResult parseItem, int foundPos) throws IOException { Asn1FieldInfo fieldInfo = fieldInfos[foundPos]; checkAndInitField(foundPos); Asn1Type fieldValue = fields[foundPos]; if (fieldValue instanceof Asn1Any) { Asn1Any any = (Asn1Any) fieldValue; any.setDecodeInfo(fieldInfo); Asn1Binder.bind(parseItem, any); } else { if (parseItem.isContextSpecific()) { Asn1Binder.bindWithTagging(parseItem, fieldValue, fieldInfo.getTaggingOption()); } else { Asn1Binder.bind(parseItem, fieldValue); } } }
@Override public void decode(ByteBuffer content) throws IOException { setValue(null); super.decode(content); }
protected void setFieldAsAny(EnumType index, Asn1Type value) { if (value != null) { Asn1Any any = new Asn1Any(value); any.setDecodeInfo(fieldInfos[index.getValue()]); setFieldAs(index, any); } }
@Override protected void decodeBody(Asn1ParseResult parseResult) throws IOException { this.parseResult = parseResult; if (valueType != null) { typeAwareDecode(valueType); } else { blindlyDecode(); } }
@Override public void decode(Asn1ParseResult parseResult) throws IOException { // Avoid the tag checking here. decodeBody(parseResult); }