|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--codec.asn1.ASN1AbstractType
|
+--codec.asn1.ASN1AbstractString
The root class of all ASN.1 string types including but not limited to IA5String, VisibleString, PrintableString, UTCTime, and GeneralizedTime.
Each string type is encoded as if it is declared as [UNIVERSAL x] IMPLICIT OCTET STRING where x is the tag number of the respective string type (see ITU-T Rec. X.690, paragraph 8.20.3).
There are 8 restructed string types of which 4 do not allow escape sequences, namely NumericString, PrintableString, VisibleString (ISO646String) and IA5String. TeletexString (T61String), VideotextString, GraphicString, and GeneralString allow the use of escape sequences. However, the srings must be encoded such as to use the minimum number of octets possible. All these strings use 1-octet representations; IA5String uses 2-octet representations for special characters.
Two unrestricted string types are defined in X.680, namely BMPString and UniversalString. BMPString uses a 2-octet representation per character and UniversalString uses a 4-octet representation.
Each string type represented in this package handles octets to character and
character to octets conversion according to the general coding scheme of the
particular string, but not neccessarily restriction to a particular character
set. This is to be implemented through constraints that
are added to the respective types on creation (in the constructors).
Restriction of character sets is thus done on the Unicode character set used
by Java.
This class implements plain 1-octet to character conversion by default. Class
ASN1BMPString handles 2-octet conversion and class
ASN1UniversalString handles 4-octets conversion.
Without reference to ISO defined character encodings these implementations
assume that the n-octet tuples represent the least significant bits
of the Unicode characters with the corresponding bits set to zero.
| Constructor Summary | |
ASN1AbstractString()
|
|
ASN1AbstractString(String s)
Creates an instance with the given string value. |
|
| Method Summary | |
String |
convert(byte[] b)
Converts the given byte array to a string by filling up each consecutive byte with 0's to the size of the Unicode characters. |
byte[] |
convert(String s)
Converts the given string to a byte array by chopping away all but the least significant byte of each character. |
int |
convertedLength(String s)
Returns the number of bytes required to store the converted string. |
void |
decode(Decoder enc)
|
void |
encode(Encoder enc)
|
boolean |
equals(Object s)
Indicates whether some other ASN.1 string is "equal to" this one. |
String |
getString()
Returns the represented string value. |
Object |
getValue()
Returns the represented string value. |
int |
hashCode()
Returns a hash code value for the object calculated from the contained String. |
void |
setString(String s)
Sets the string value. |
protected void |
setString0(String s)
|
String |
toString()
|
| Methods inherited from class codec.asn1.ASN1AbstractType |
checkConstraints, getConstraint, getTag, getTagClass, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface codec.asn1.ASN1Type |
checkConstraints, getConstraint, getTag, getTagClass, isExplicit, isOptional, isType, setConstraint, setExplicit, setOptional |
| Constructor Detail |
public ASN1AbstractString()
public ASN1AbstractString(String s)
setString to set the string
value.s - The string value.| Method Detail |
public Object getValue()
getValue in interface ASN1TypegetValue in class ASN1AbstractTypepublic String getString()
getString in interface ASN1String
public void setString(String s)
throws ConstraintException
setString in interface ASN1Strings - The string value.ConstraintException - if the given string does not match the constraint set for
this instance.protected void setString0(String s)
public void encode(Encoder enc)
throws ASN1Exception,
IOException
encode in interface ASN1Typeencode in class ASN1AbstractType
public void decode(Decoder enc)
throws ASN1Exception,
IOException
decode in interface ASN1Typedecode in class ASN1AbstractType
public String convert(byte[] b)
throws ASN1Exception
convert in interface ASN1Stringb - The byte array to convert.ASN1Exception - never, only for compliance with the ASN1String
interface.
public byte[] convert(String s)
throws ASN1Exception
convert in interface ASN1Strings - The string to convert.ASN1Exception - never, only for compliance with the ASN1String
interface.
public int convertedLength(String s)
throws ASN1Exception
convertedLength in interface ASN1Strings - The string.ASN1Exception - never, only for compliance with the ASN1String
interface.public String toString()
toString in class Objectpublic boolean equals(Object s)
equals in class Objects - the reference string with which to compare.Object.equals(java.lang.Object)public int hashCode()
String.hashCode in class ObjectObject.hashCode()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||