public static class SEQUENCE.Template extends java.lang.Object implements ASN1Template
SEQUENCE
from its BER encoding.
It is an ordered collection of sub-templates. Each sub-template can be
marked optional, or a default value can be given.Constructor and Description |
---|
SEQUENCE.Template() |
Modifier and Type | Method and Description |
---|---|
void |
addElement(ASN1Template t)
Adds a sub-template to the end of this SEQUENCE template.
|
void |
addElement(ASN1Template t,
ASN1Value def)
Adds a sub-template with a default value.
|
void |
addElement(Tag implicitTag,
ASN1Template t)
Adds a sub-template to the end of this SEQUENCE template, with the
given implicit tag.
|
void |
addElement(Tag implicitTag,
ASN1Template t,
ASN1Value def)
Adds a sub-template with a default value and an implicit tag.
|
void |
addOptionalElement(ASN1Template t)
Adds an optional sub-template.
|
void |
addOptionalElement(Tag implicitTag,
ASN1Template t)
Adds an optional sub-template with an implicit tag.
|
ASN1Value |
decode(java.io.InputStream istream)
Decodes a SEQUENCE from its BER encoding.
|
ASN1Value |
decode(Tag tag,
java.io.InputStream istream)
Decodes a SEQUENCE from its BER encoding, where the SEQUENCE itself has
an implicit tag.
|
ASN1Value |
defaultAt(int index)
Returns the default value for the sub-template at the given index.
|
Tag |
implicitTagAt(int index)
Returns the implicit tag of the item stored at the given index.
|
void |
insertElementAt(ASN1Template t,
ASN1Value def,
int index)
Inserts the template with the given default
value at the given index.
|
void |
insertElementAt(ASN1Template t,
int index)
Inserts the template at the given index.
|
void |
insertElementAt(Tag implicit,
ASN1Template t,
ASN1Value def,
int index)
Inserts the template with the given implicit tag and given default
value at the given index.
|
void |
insertElementAt(Tag implicit,
ASN1Template t,
int index)
Inserts the template with the given implicit tag at the given index.
|
void |
insertOptionalElementAt(ASN1Template t,
int index)
Inserts the optional template at the given index.
|
void |
insertOptionalElementAt(Tag implicit,
ASN1Template t,
int index)
Inserts the optional template with the given default
value at the given index.
|
boolean |
isOptionalAt(int index)
Returns whether the sub-template at the given index is optional.
|
void |
removeAllElements()
Removes all sub-templates from this SEQUENCE template.
|
void |
removeElementAt(int index)
Removes the sub-template at the given index.
|
int |
size()
Returns the number of elements in this SEQUENCE template.
|
boolean |
tagMatch(Tag tag)
Determines whether the given tag will satisfy this template.
|
ASN1Template |
templateAt(int index)
Returns the sub-template stored at the given index.
|
public void addElement(ASN1Template t)
MySequence ::= SEQUENCE { item SubType, ... }the "item" element would be added to the MySequence template with:
mySequence.addElement( new SubType.Template() );
public void insertElementAt(ASN1Template t, int index)
public void addElement(Tag implicitTag, ASN1Template t)
MySequence ::= SEQUENCE { item [0] IMPLICIT SubType, ... }the "item" element would be added to the MySequence template with:
mySequence.addElement( new Tag(0), new SubType.Template());
public void insertElementAt(Tag implicit, ASN1Template t, int index)
public void addOptionalElement(ASN1Template t)
MySequence ::= SEQUENCE { item SubType OPTIONAL, ... }the "item" element would be added to the MySequence template with:
mySequence.addOptionalElement( new SubType.Template() );
public void insertOptionalElementAt(ASN1Template t, int index)
public void addOptionalElement(Tag implicitTag, ASN1Template t)
MySequence ::= SEQUENCE { item [0] IMPLICIT SubType OPTIONAL, ... }the "item" element would be added to the MySequence template with:
mySequence.addOptionalElement( new SubType.Template() );
public void insertOptionalElementAt(Tag implicit, ASN1Template t, int index)
public void addElement(ASN1Template t, ASN1Value def)
MySequence ::= SEQUENCE { version INTEGER DEFAULT 1, ... }the "item" element would be added to the MySequence template with:
mySequence.addElement( new INTEGER.Template(), new INTEGER(1) );
def
- The default value for this field, which will be used if
no value is supplied by the encoded structure. It must be of
the same type as what the template would produce.public void insertElementAt(ASN1Template t, ASN1Value def, int index)
public void addElement(Tag implicitTag, ASN1Template t, ASN1Value def)
MySequence ::= SEQUENCE { version [0] IMPLICIT INTEGER DEFAULT 1, ... }the "item" element would be added to the MySequence template with:
mySequence.addElement( new Tag(0), new INTEGER.Template(), new INTEGER(1) );
def
- The default value for this field, which will be used if
no value is supplied by the encoded structure. It must be of
the same type as what the template would produce.public void insertElementAt(Tag implicit, ASN1Template t, ASN1Value def, int index)
public Tag implicitTagAt(int index)
public ASN1Template templateAt(int index)
public boolean isOptionalAt(int index)
public ASN1Value defaultAt(int index)
public int size()
public void removeAllElements()
public void removeElementAt(int index)
public boolean tagMatch(Tag tag)
ASN1Template
tagMatch
in interface ASN1Template
public ASN1Value decode(java.io.InputStream istream) throws java.io.IOException, InvalidBERException
decode
in interface ASN1Template
istream
- Must support marking (markSupported() == true).
For example, ByteArrayInputStream and BufferedInputStream
support marking, but FileInputStream does not. If your source
does not support marking, you can wrap it in a
BufferedInputStream.java.io.IOException
InvalidBERException
public ASN1Value decode(Tag tag, java.io.InputStream istream) throws java.io.IOException, InvalidBERException
decode
in interface ASN1Template
istream
- Must support marking (markSupported() == true).
For example, ByteArrayInputStream and BufferedInputStream
support marking, but FileInputStream does not. If your source
does not support marking, you can wrap it in a
BufferedInputStream.java.io.IOException
InvalidBERException