IAIK TSP
version 2.32

iaik.tsp
Class PKIFreeText

java.lang.Object
  extended by iaik.tsp.PKIFreeText

public class PKIFreeText
extends java.lang.Object

This class implements the TSP ASN.1 type PKIFreeText as it is specified in RFC 3161.

 PKIFreeText ::= SEQUENCE {
     SIZE (1..MAX) OF UTF8String
     -- text encoded as UTF-8 String (note: each UTF8String SHOULD
     -- include an RFC 1766 language tag to indicate the language -- of the contained text)
 }
 

This class handles the ASN.1 structure and the DER encoding and decoding of this structure.


Constructor Summary
PKIFreeText(ASN1Object component)
          This constructor tries to reconstruct a PKIFreeText object from the given ASN.1 structure.
PKIFreeText(java.lang.String text)
          To construct a new PKIFreeText object with the given String.
 
Method Summary
 void addString(java.lang.String text)
          This method adds a new string to the end of the structure.
 byte[] getEncoded()
          This method DER encodes the ASN.1 PKIFreeText object.
 int getSize()
          Returns the number of string elements.
 java.lang.String getStringAt(int position)
          This method returns the string at the specified index.
 void setStringAt(java.lang.String text, int position)
          This method sets a string at the specified index.
 ASN1Object toASN1Object()
          Returns the ASN.1 structure of the PKIFreeText object.
 java.lang.String toString()
          This method returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PKIFreeText

public PKIFreeText(java.lang.String text)
            throws java.lang.NullPointerException
To construct a new PKIFreeText object with the given String.

Parameters:
text - A message string.
Throws:
java.lang.NullPointerException - Thrown if the argument is null.

PKIFreeText

public PKIFreeText(ASN1Object component)
            throws CodingException
This constructor tries to reconstruct a PKIFreeText object from the given ASN.1 structure.

Parameters:
component - The ASN.1 structure.
Throws:
CodingException - Thrown if the given ASN1Object is not a PKIFreeText ASN.1 object.
Method Detail

getEncoded

public byte[] getEncoded()
This method DER encodes the ASN.1 PKIFreeText object.

Returns:
DER encoded PKIFreeText object.

toASN1Object

public ASN1Object toASN1Object()
Returns the ASN.1 structure of the PKIFreeText object.

Returns:
ASN1Object of the PKIFreeText object.

addString

public void addString(java.lang.String text)
This method adds a new string to the end of the structure.

Parameters:
text - Text to be added.

setStringAt

public void setStringAt(java.lang.String text,
                        int position)
                 throws java.lang.ArrayIndexOutOfBoundsException
This method sets a string at the specified index. This method overwrites an existing text string. To add a new string you must use the addString method.

Parameters:
text - Text to be set.
position - Position of the text.
Throws:
java.lang.ArrayIndexOutOfBoundsException - Thrown if the index is invalid.

getSize

public int getSize()
Returns the number of string elements.

Returns:
The number of the string elements.

getStringAt

public java.lang.String getStringAt(int position)
                             throws java.lang.ArrayIndexOutOfBoundsException
This method returns the string at the specified index.

Parameters:
position - The position of the desired text.
Returns:
The string at the specified index
Throws:
java.lang.ArrayIndexOutOfBoundsException - Thrown if the index is invalid.

toString

public java.lang.String toString()
This method returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
A string representing the PKIFreeText object.

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK TSP, © 2002 IAIK, © 2003 - 2014 Stiftung SIC