OSDN Git Service

0dadef972db3dfebfb434f6d6f3123af0b005fa0
[bm-asn1/bm-asn1.git] / jp / bitmeister / asn1 / type / useful / VideotexString.java
1 /*
2  * Copyright 2011 BitMeister Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package jp.bitmeister.asn1.type.useful;
17
18 import java.nio.charset.Charset;
19 import java.util.regex.Pattern;
20
21 import jp.bitmeister.asn1.annotation.ASN1BuiltIn;
22 import jp.bitmeister.asn1.annotation.ASN1Tag;
23 import jp.bitmeister.asn1.type.ASN1TagClass;
24 import jp.bitmeister.asn1.type.ASN1TagMode;
25 import jp.bitmeister.asn1.type.StringType;
26
27 /**
28  * Represents ASN.1 'VideotexString' type.
29  * 
30  * <p>
31  * An instance of this class represents a 'VideotexString' type data. Characters
32  * which can appear in the {@code VideotexString} are defined in some CCITT
33  * recommendations. In this library, ISO-8859-1 encoding is used for this type.
34  * </p>
35  * 
36  * @author WATANABE, Jun. <jwat at bitmeister.jp>
37  */
38 @ASN1BuiltIn
39 @ASN1Tag(tagClass = ASN1TagClass.UNIVERSAL, value = 21, tagMode = ASN1TagMode.IMPLICIT)
40 public class VideotexString extends StringType {
41
42         /**
43          * The name of character set that is used for converting value to
44          * {@code String}. Default value for this type is 'ISO-8859-1'.
45          */
46         public static String charsetName = "ISO-8859-1";
47
48         /**
49          * Instantiates an empty {@code VideotexString}.
50          */
51         public VideotexString() {
52         }
53
54         /**
55          * Instantiates an {@code VideotexString} and initialize it with the
56          * {@code String} value.
57          * 
58          * @param value
59          *            The value assigned to the instance.
60          */
61         public VideotexString(String value) {
62                 set(value);
63         }
64
65         /*
66          * (non-Javadoc)
67          * 
68          * @see jp.bitmeister.asn1.type.StringType#charset()
69          */
70         @Override
71         public Charset charset() {
72                 return Charset.forName(charsetName);
73         }
74
75         /*
76          * (non-Javadoc)
77          * 
78          * @see jp.bitmeister.asn1.type.StringType#pattern()
79          */
80         @Override
81         protected Pattern pattern() {
82                 return null;
83         }
84
85 }