pasn
Class ASN1String

java.lang.Object
  extended by pasn.ASN1Object
      extended by pasn.ASN1SimpleObject<java.lang.String>
          extended by pasn.ASN1String
All Implemented Interfaces:
ASN1DefaultValuedObject, ASN1EncodingSpecificObject, ASN1GenericObject, ASN1PrimitiveObject<java.lang.String>, ASN1Resetable
Direct Known Subclasses:
ASN1BMPString, ASN1GeneralString, ASN1GraphicString, ASN1IA5String, ASN1NumericString, ASN1PrintableString, ASN1TeletexString, ASN1UniversalString, ASN1UTF8String, ASN1VideotexString, ASN1VisibleString

public abstract class ASN1String
extends ASN1SimpleObject<java.lang.String>

Basic class to express ASN.1 STRING objects. Strings hierarchy is defined as follows:

                              Numeric String
                                   |
                                   V
                             Printable String
                                   |
                                   V
                                IA5 String
                                   |
                                   V
                               T.61 String
                                   |
                                   V
                                BMP String
                                   |
                                   V
                              Universal String
 
US-ASCII Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
ISO-8859-1 ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
UTF-8 Eight-bit Unicode Transformation Format
UTF-16BE Sixteen-bit Unicode Transformation Format, big-endian byte order
UTF-16LE Sixteen-bit Unicode Transformation Format, little-endian byte order
UTF-16 Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order accepted on input, big-endian used on output)

Author:
ncottin

Constructor Summary
ASN1String(int type)
           Creates an empty ASN.1 character String object of the given type and string encoding format
 
Method Summary
 java.lang.String getExpression()
           
 int getMaximumLength()
           
 int getMininimumLength()
           
 boolean hasDefaultValue()
           
 boolean hasExpression()
           
 boolean hasValue()
           
static boolean isInside(char c, char[] values)
           
 boolean isMaximumLengthConstrained()
           
 boolean isMinimumLengthConstrained()
           
 boolean isValueDefault()
           
 void reset()
           Removes the value (or list or set of values) of this ASN.1 object.
 void setDecodedValue(java.lang.Object value)
           
 void setExpression(java.lang.String regex)
           
 void setMaximumLength(int maxLength)
           
 void setMinimumLength(int minLength)
           
 java.lang.String toString()
           
 boolean validate(char value, int index)
           This operation complements character restrictions with specific constraints
abstract  boolean validateChar(char value, int index)
           Constraints this STRING by indicating if the given character is accepted or rejected
 void validateConstraints(java.lang.String value)
           
 boolean validateExpression(java.lang.String value)
           
 
Methods inherited from class pasn.ASN1SimpleObject
equals, getDefaultValue, getValue, getValueOrDefault, hasValueOrDefault, setDefaultValue, setValue
 
Methods inherited from class pasn.ASN1Object
getAsnClass, getSpecificEncoding, getSpecificEncoding, getType, hasSpecificEncodings, setSpecificEncoding
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pasn.ASN1GenericObject
getASN1Name, getAsnClass, getType
 
Methods inherited from interface pasn.ASN1EncodingSpecificObject
getSpecificEncoding, hasSpecificEncodings
 

Constructor Detail

ASN1String

public ASN1String(int type)

Creates an empty ASN.1 character String object of the given type and string encoding format

Parameters:
type - The type of this String, given by String types from ASN1Constants
Method Detail

setMinimumLength

public final void setMinimumLength(int minLength)

getMininimumLength

public final int getMininimumLength()

isMinimumLengthConstrained

public final boolean isMinimumLengthConstrained()

setMaximumLength

public final void setMaximumLength(int maxLength)

getMaximumLength

public final int getMaximumLength()

isMaximumLengthConstrained

public final boolean isMaximumLengthConstrained()

setExpression

public final void setExpression(java.lang.String regex)

getExpression

public final java.lang.String getExpression()

hasExpression

public final boolean hasExpression()

validateExpression

public final boolean validateExpression(java.lang.String value)

isInside

public static final boolean isInside(char c,
                                     char[] values)

validateConstraints

public final void validateConstraints(java.lang.String value)
                               throws ASN1ConstraintException
Throws:
ASN1ConstraintException

validateChar

public abstract boolean validateChar(char value,
                                     int index)

Constraints this STRING by indicating if the given character is accepted or rejected

Parameters:
value - A character which is part of the string to initialize this ASN.1 STRING with
index - The index of the given character within the global string. This is mainly used by {jade.ASN1BMPString}
Returns:
True if the given character value is accepted and false if it is rejected

validate

public boolean validate(char value,
                        int index)

This operation complements character restrictions with specific constraints

Parameters:
value - A character taken from the string to initialize this ASN.1 String with
index - The position of value within the string
Returns:
True if this character is valid at the given position, false otherwise

reset

public final void reset()
Description copied from interface: ASN1Resetable

Removes the value (or list or set of values) of this ASN.1 object. This applies to simple and structured ASN.1 objects


isValueDefault

public final boolean isValueDefault()

hasValue

public final boolean hasValue()

hasDefaultValue

public final boolean hasDefaultValue()

setDecodedValue

public final void setDecodedValue(java.lang.Object value)
                           throws ASN1FormatException,
                                  ASN1ConstraintException
Throws:
ASN1FormatException
ASN1ConstraintException

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object