@Override protected int encodingBodyLength() { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue == null) { return 0; } return -1; // Indicate error, shouldn't be here. }
@Override protected int encodingBodyLength() { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue == null) { return 0; } return -1; // Indicate error, shouldn't be here. }
protected <T extends Asn1Type> T getChoiceValueAs(EnumType index, Class<T> t) { if (chosenField == null || getValue() == null) { return null; } if (chosenField != null && index != chosenField.getIndex()) { throw new IllegalArgumentException("Incorrect chosen value requested"); } return (T) getValue(); }
protected <T extends Asn1Type> T getChoiceValueAs(EnumType index, Class<T> t) { if (chosenField == null || getValue() == null) { return null; } if (chosenField != null && index != chosenField.getIndex()) { throw new IllegalArgumentException("Incorrect chosen value requested"); } return (T) getValue(); }
@Override public void encode(ByteBuffer buffer) throws IOException { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); theValue.taggedEncode(buffer, taggingOption); } else { theValue.encode(buffer); } } }
@Override protected void encodeBody(ByteBuffer buffer) throws IOException { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); theValue.taggedEncode(buffer, taggingOption); } else { theValue.encode(buffer); } } }
@Override public void dumpWith(Asn1Dumper dumper, int indents) { Asn1Type theValue = getValue(); dumper.indent(indents).append("<Choice>").newLine(); //dumper.append(simpleInfo()).newLine(); dumper.dumpType(indents, theValue); } }
@Override public void dumpWith(Asn1Dumper dumper, int indents) { Asn1Type theValue = getValue(); dumper.indent(indents).append("<Choice>").newLine(); //dumper.append(simpleInfo()).newLine(); dumper.dumpType(indents, theValue); } }
@Override public void encode(ByteBuffer buffer) throws IOException { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); theValue.taggedEncode(buffer, taggingOption); } else { theValue.encode(buffer); } } }
@Override protected void encodeBody(ByteBuffer buffer) throws IOException { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); theValue.taggedEncode(buffer, taggingOption); } else { theValue.encode(buffer); } } }
@Override public byte[] encode() throws IOException { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); return theValue.taggedEncode(taggingOption); } else { return theValue.encode(); } } return null; }
@Override public byte[] encode() throws IOException { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); return theValue.taggedEncode(taggingOption); } else { return theValue.encode(); } } return null; }
@Override public int encodingLength() { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); return theValue.taggedEncodingLength(taggingOption); } else { return theValue.encodingLength(); } } return super.encodingLength(); }
@Override public int encodingLength() { Asn1Encodeable theValue = (Asn1Encodeable) getValue(); if (theValue != null) { if (chosenField.isTagged()) { TaggingOption taggingOption = chosenField.getTaggingOption(); return theValue.taggedEncodingLength(taggingOption); } else { return theValue.encodingLength(); } } return super.encodingLength(); }
@Override protected void decodeBody(Asn1ParseResult parseResult) throws IOException { if (chosenField == null) { matchAndSetValue(parseResult.tag()); } if (chosenField == null) { throw new IOException("Unexpected item, not in choices: " + parseResult.simpleInfo()); } Asn1Type fieldValue = getValue(); if (parseResult.isContextSpecific()) { Asn1Binder.bindWithTagging(parseResult, fieldValue, chosenField.getTaggingOption()); } else { Asn1Binder.bind(parseResult, fieldValue); } }
@Override protected void decodeBody(Asn1ParseResult parseResult) throws IOException { if (chosenField == null) { matchAndSetValue(parseResult.tag()); } if (chosenField == null) { throw new IOException("Unexpected item, not in choices: " + parseResult.simpleInfo()); } Asn1Type fieldValue = getValue(); if (parseResult.isContextSpecific()) { Asn1Binder.bindWithTagging(parseResult, fieldValue, chosenField.getTaggingOption()); } else { Asn1Binder.bind(parseResult, fieldValue); } }