jp.bitmeister.asn1.type
Class StringType

java.lang.Object
  extended by jp.bitmeister.asn1.type.ASN1Type
      extended by jp.bitmeister.asn1.type.PrimitiveType<byte[]>
          extended by jp.bitmeister.asn1.type.builtin.OCTET_STRING
              extended by jp.bitmeister.asn1.type.StringType
All Implemented Interfaces:
java.lang.Cloneable, Concatenatable<OCTET_STRING>, SizeCountable
Direct Known Subclasses:
BMPString, GeneralString, GraphicString, IA5String, NumericString, PrintableString, TeletexString, TimeType, UniversalString, UTF8String, VideotexString, VisibleString

public abstract class StringType
extends OCTET_STRING

The base class for character string types.

This class provides generic interfaces and common methods for classes that represents character string types.

Author:
WATANABE, Jun.

Field Summary
 
Fields inherited from class jp.bitmeister.asn1.type.ASN1Type
stringBuilder
 
Constructor Summary
StringType()
           
 
Method Summary
<E extends java.lang.Throwable>
void
accept(ASN1Visitor<E> visitor)
          Accepts the ASN1Visitor and calls a visit method of the visitor.
protected abstract  java.nio.charset.Charset charset()
          Returns the Charset used for encoding and decodiong the value of this data.
protected  void checkCharacters(java.lang.String value)
          Tests if the characters are valid for this type.
protected abstract  java.util.regex.Pattern pattern()
          Returns the Pattern used for checking characters that to be set to this data.
 void set(java.lang.String value)
          Set the String to this instance.
 java.lang.String stringValue()
          Converts the array of byte value of this instance to a String and returns it.
 
Methods inherited from class jp.bitmeister.asn1.type.builtin.OCTET_STRING
cloneValue, concatenate, set, size, valueEquals
 
Methods inherited from class jp.bitmeister.asn1.type.PrimitiveType
clear, clone, hashCode, hasValue, set, value
 
Methods inherited from class jp.bitmeister.asn1.type.ASN1Type
equals, instantiate, matches, specification, toString, validate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringType

public StringType()
Method Detail

set

public void set(java.lang.String value)
Set the String to this instance. If the type has character limitation, characters contained in the string are checked before assignment.

Parameters:
value - The string value to be assigned.

stringValue

public java.lang.String stringValue()
Converts the array of byte value of this instance to a String and returns it.

Returns:
The string value assigned to this instance.

charset

protected abstract java.nio.charset.Charset charset()
Returns the Charset used for encoding and decodiong the value of this data.

Returns:
The Charset.

pattern

protected abstract java.util.regex.Pattern pattern()
Returns the Pattern used for checking characters that to be set to this data.

Returns:
The Pattern.

checkCharacters

protected void checkCharacters(java.lang.String value)
Tests if the characters are valid for this type.

Parameters:
value - true when the characters is valid.

accept

public <E extends java.lang.Throwable> void accept(ASN1Visitor<E> visitor)
            throws E extends java.lang.Throwable
Description copied from class: ASN1Type
Accepts the ASN1Visitor and calls a visit method of the visitor.

Overrides:
accept in class OCTET_STRING
Parameters:
visitor - The visitor.
Throws:
E extends java.lang.Throwable