public class SET extends ConstructedType
A SET object is DER encoded using the constructed encoding practice
by splitting it into separately encoded components. Therefore the SEQUENCE class is
extended to be a subclass of the ConstructedType
class. Each component can be added to the current SET object by using a proper
addComponent method of
the ConstructedType super class.
The constructed form can be recognized by bit 6 of the (first) identifier octet(s) of the DER encoded bit stream, which is set to 1.
The following example creates a new SET object and adds an INTERGER, BOOLEAN, and a PrintableString component:
SET set = new SET();
set.addComponent(new INTEGER(3));
set.addComponent(new BOOLEAN(true));
set.addComponent(new PrintableString("Test"));
Of course, sets may be nested meaning that one SET contains another
SET as one of its components. The nesting may be of any depth.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
sorted |
content_count, content_dataasnType, constructed, encode_listener, indefinite_length, isStringType, stream_mode| Constructor and Description |
|---|
SET()
Creates a new SET.
|
SET(boolean sorted)
Creates a new SET.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
encode(java.io.OutputStream os)
DER encodes this ASN1Object and writes the result to the supplied OutputStream.
|
java.lang.String |
toString()
Returns a String that represents the value of this SET.
|
addComponent, addComponent, addEncodeListener, countComponents, decode, getComponentAt, getComponents, getValue, removeComponent, removeComponent, setComponent, setValueaddEncodeListener, encodeObject, getAsnType, indefiniteLength, isA, isConstructed, isStringType, setAutomaticRepair, setAutomaticRepairRecursive, setIndefiniteLength, setIndefiniteRecursivepublic SET()
Components may be added by means of the addComponent method of the ConstructedType
super class.
public SET(boolean sorted)
sorted is set to true the
components are sorted by their encodings. This constructor only shall
be used for creating SET OF structures where all components have the
same type. In this way, an application may prefer to call the createSetOf(ASN1Type[] array, boolean sorted) method of class
ASN for creating the SET OF.sorted - whether to sort the components by their encodings or notpublic java.lang.String toString()
toString in class ASN1ObjectASN1Object.toString()protected void encode(java.io.OutputStream os)
throws java.io.IOException
ConstructedTypeencode in class ConstructedTypeos - the output stream to which to write the datajava.io.IOException - if an error occurs while reading from the stream