|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--iaik.asn1.ASN1Object
|
+--iaik.asn1.UTF8String
This class implements the ASN.1 character string type "UTF8String". UTF8String is a simple ASN.1 string type identified by the UNIVERSAL TAG number 12.
UTF-8 (UCS transformation format 8) is an encoding format that has been developed for handling UCS-2/UCS-4 multi-octet character sets by applications that operate on 7, 8 bit characters. UTF-8 is specified by ISO 10646 in RFC 2279.
RFC 2279 gives an algorithm for transforming UCS-4/UCS-2 multi octet characters into UTF-8 octet sequences. This class can be used for UTF-8 encoding UCS-2/Unicode character strings according to the following rules:
When creating a new UTF8String object the value to be represented
has to be supplied as Java String type:
String s = ...; UTF8String UTF8String = new UTF8String(s);When calling the
getValue method for getting the inherent string
value from an ASN.1 UTF8String instance, a Java object of type String
is returned:
String s = (String)UTF8String.getValue();DER en/decoding generally is done by means of the several methods of the
DerCoder class; decoding alternatively may be performed by
using the DerInputStream utility.
ASN1Object,
ASN| Fields inherited from class iaik.asn1.ASN1Object |
asnType,
encode_listener,
stream_mode |
| Constructor Summary | |
protected |
UTF8String()
Creates an empty UTF8String. |
|
UTF8String(java.lang.String value)
Creates a new ASN.1 UTF8String object for the given String value. |
| Method Summary | |
protected void |
decode(int length,
java.io.InputStream is)
Decodes an UTF8String value from the given InputStream. |
protected void |
encode(java.io.OutputStream os)
DER encodes this UTF8String ASN1Object and writes the result to the given output stream. |
java.lang.Object |
getValue()
Returns the value of this UTF8String as a String object. |
void |
setValue(java.lang.Object object)
Sets the value of this UTF8String. |
java.lang.String |
toString()
Returns a string that represents the contents of this UTF8String. |
| Methods inherited from class iaik.asn1.ASN1Object |
addComponent,
addEncodeListener,
countComponents,
encodeObject,
getAsnType,
getComponentAt,
indefiniteLength,
isA,
isConstructed,
setIndefiniteLength,
setIndefiniteRecursive |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
protected UTF8String()
public UTF8String(java.lang.String value)
value - the String value this UTF8String object should be initialized with| Method Detail |
public java.lang.Object getValue()
public void setValue(java.lang.Object object)
The supplied value has to be a Java object of type String.
object - the Java String value to be set for this UTF8String
protected void encode(java.io.OutputStream os)
throws java.io.IOException
This is a protected method and will not be used by an application for
DER encoding an UTF8String object. An application will call one of the
encode methods of the DerCoder
class for performing the encoding, and the DerCoder internally will call
this encode method.
os - the output stream to which to write the data
protected void decode(int length,
java.io.InputStream is)
throws java.io.IOException
length bytes to be read represent the value of an
ASN.1 object of type UTF8String.
This is a protected method and will not be used by
an application for decoding a DER encoded UTF8String. An
application will call one of the decode methods of
the DerCoder class for performing
the decoding. The DerCoder then determines the number of bytes
(length) occupied by the value of this UTF8String
object and internally calls this decode method for
actually reading the value. No check is performed if the received
value actually is composed only of characters belonging to the
UTF8String character set!
length - the already decoded length, i.e. number of the bytes
representing the value of the UTF8String to be decodedis - the input stream from which the DER encoded data is read inpublic java.lang.String toString()
ASN1Object.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||