/** * See avove. */ public static void decode(ByteBuffer content, Asn1Type value) throws IOException { value.decode(content); }
/** * Encode value into buffer. * @param buffer * @param value * @throws IOException */ public static void encode(ByteBuffer buffer, Asn1Type value) throws IOException { value.encode(buffer); }
@Override protected void encodeBody(ByteBuffer buffer) throws IOException { for (int i = 0; i < fields.length; ++i) { Asn1Type field = fields[i]; if (field != null) { if (fieldInfos[i].isTagged()) { TaggingOption taggingOption = fieldInfos[i].getTaggingOption(); field.taggedEncode(buffer, taggingOption); } else { field.encode(buffer); } } } }
public Tag getFieldTag() { if (tag == null) { Asn1Type fieldValue = createFieldValue(); tag = fieldValue.tag(); } return tag; }
public static void bind(Asn1ParseResult parseResult, Asn1Type value) throws IOException { value.useDefinitiveLength(parseResult.isDefinitiveLength()); ((Asn1Encodeable) value).decode(parseResult); }
@Override public void useImplicit(boolean isImplicit) { super.useImplicit(isImplicit); if (!isImplicit) { //In effect, explicitly tagged types are structured types consisting // of one component, the underlying type. usePrimitive(false); } else { usePrimitive(getValue().isPrimitive()); } }
@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; }
@Override protected void encodeBody(ByteBuffer buffer) throws IOException { for (int i = 0; i < fields.length; ++i) { Asn1Type field = fields[i]; if (field != null) { if (fieldInfos[i].isTagged()) { TaggingOption taggingOption = fieldInfos[i].getTaggingOption(); field.taggedEncode(buffer, taggingOption); } else { field.encode(buffer); } } } }
public Tag getFieldTag() { if (tag == null) { Asn1Type fieldValue = createFieldValue(); tag = fieldValue.tag(); } return tag; }
public static void bind(Asn1ParseResult parseResult, Asn1Type value) throws IOException { value.useDefinitiveLength(parseResult.isDefinitiveLength()); ((Asn1Encodeable) value).decode(parseResult); }
@Override public void useImplicit(boolean isImplicit) { super.useImplicit(isImplicit); if (!isImplicit) { //In effect, explicitly tagged types are structured types consisting // of one component, the underlying type. usePrimitive(false); } else { usePrimitive(getValue().isPrimitive()); } }
@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; }
/** * Encode value into buffer. * @param buffer * @param value * @throws IOException */ public static void encode(ByteBuffer buffer, Asn1Type value) throws IOException { value.encode(buffer); }
/** * See avove. */ public static void decode(ByteBuffer content, Asn1Type value) throws IOException { value.decode(content); }
@Override public Tag tag() { if (getValue() != null) { return getValue().tag(); } else if (parseResult != null) { return parseResult.tag(); } return super.tag(); }
/** * Encode value and return the result. * @param value * @return * @throws IOException */ public static byte[] encode(Asn1Type value) throws IOException { return value.encode(); }
/** * Decode using specified value container. Better to use this when the value * type is known prior to the call. * @param content * @param value * @throws IOException */ public static void decode(byte[] content, Asn1Type value) throws IOException { value.decode(content); }
@Override public Tag tag() { if (getValue() != null) { return getValue().tag(); } else if (chosenField != null) { return chosenField.getFieldTag(); } return super.tag(); }
/** * Encode value and return the result. * @param value * @return * @throws IOException */ public static byte[] encode(Asn1Type value) throws IOException { return value.encode(); }
/** * Decode using specified value container. Better to use this when the value * type is known prior to the call. * @param content * @param value * @throws IOException */ public static void decode(byte[] content, Asn1Type value) throws IOException { value.decode(content); }