public class DirStrConverter extends java.lang.Object implements AVAValueConverter
The string to DerValue conversion is done as follows. If the string has only PrintableString characters it is converted to a ASN.1 Printable String using the PrintableString encoder from the global default ASN1CharStrConvMap. If it has only characters covered in the PrintableString or T.61 character set it is converted to a ASN.1 T.61 string using the T.61 encoder from the ASN1CharStrCovnMap. Otherwise it is converted to a ASN.1 UniversalString (UCS-4 character set) which covers all characters.
AVAValueConverter
,
ASN1CharStrConvMap
Constructor and Description |
---|
DirStrConverter()
Constructs a DirStrConverter.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAsString(DerValue avaValue)
Converts a DerValue to a string.
|
DerValue |
getValue(byte[] berByteStream)
Creates a DerValue from a BER encoded value, obtained from for example
a attribute value in octothorpe form of a Ldap DN string.
|
DerValue |
getValue(java.lang.String ds)
Converts a string to a DER encoded attribute value.
|
DerValue |
getValue(java.lang.String valueString,
byte[] tags)
Like getValue(String) with specified DER tags as encoding order.
|
static void |
setDefEncodingOrder(byte[] defEncodingOrder) |
public static void setDefEncodingOrder(byte[] defEncodingOrder)
public DerValue getValue(java.lang.String ds) throws java.io.IOException
AVAValueConverter
getValue
in interface AVAValueConverter
ds
- An AVA value string not encoded in any form.java.io.IOException
- if an error occurs during the conversion.public DerValue getValue(java.lang.String valueString, byte[] tags) throws java.io.IOException
getValue
in interface AVAValueConverter
valueString
- An AVA value string not encoded in any form.java.io.IOException
- if an error occurs during the conversion.public DerValue getValue(byte[] berByteStream) throws java.io.IOException
getValue
in interface AVAValueConverter
berByteStream
- Byte array of a BER encoded value.java.io.IOException
- If the BER value cannot be converted to a
valid Directory String DER value.public java.lang.String getAsString(DerValue avaValue) throws java.io.IOException
getAsString
in interface AVAValueConverter
avaValue
- a DerValuejava.io.IOException
- if a decoder needed for the
conversion is not available.