📄 bmpstring.java
字号:
/* $Id: BMPString.java,v 1.2 2001/05/24 16:52:49 raif Exp $
*
* Copyright (C) 1997-2001 The Cryptix Foundation Limited. All rights reserved.
*
* Use, modification, copying and distribution of this software is subject to
* the terms and conditions of the Cryptix General Licence. You should have
* received a copy of the Cryptix General Licence along with this library; if
* not, you can download a copy from http://www.cryptix.org/
*/
package cryptix.asn1.lang;
import cryptix.asn1.io.ASNReader;
import cryptix.asn1.io.ASNWriter;
import cryptix.asn1.io.BlankElementException;
import cryptix.asn1.io.ElementNotFoundException;
import org.apache.log4j.Category;
import java.io.EOFException;
import java.io.IOException;
/**
* The basic implementation of an ASN.1 BMPString type.<p>
*
* @version $Revision: 1.2 $
* @author Raif S. Naffah
*/
public class BMPString extends ASNString implements IType {
// Constants and vars
// .......................................................................
static Category cat = Category.getInstance(BMPString.class.getName());
// Constructor(s)
// .......................................................................
public BMPString() {
super("", new Tag(Tag.BMP_STRING));
}
public BMPString(String name) {
super(name, new Tag(Tag.BMP_STRING));
}
public BMPString(String name, Tag tag) {
super(name, tag);
}
public BMPString(String name, Object value) {
this(name, new Tag(Tag.BMP_STRING), value);
}
/**
* Constructs a new instance of a BMPString type, given a designated
* Tag and a designated initial value.
*
* @param name the name of this instance.
* @param tag the designated Tag value.
* @param value the designated initial value. Allowed types are:
* <tt>java.lang.String</tt>, and any subclass of <tt>cryptix.asn1.lang.ASNString</tt>.
* @exception ClassCastException if the designated value is not a String.
*/
public BMPString(String name, Tag tag, Object value) {
super(name, tag);
value(value);
if (this.value != null)
defaultValue(this.value);
}
// Class methods
// .......................................................................
/**
* Returns a new instance of this type with a trivial name and the
* designated value.
*
* @param value a designated initial value for the new instance.
* @return a new instance with the designated value.
* @exception ClassCastException if the designated value is not appropriate
* (see constructor with 3 arguments for suitable types of value).
*/
public static BMPString getInstance(String value) {
return new BMPString("", value);
}
/**
* Returns a new instance of this type with a trivial name and the
* designated value.
*
* @param value a designated initial value for the new instance.
* @return a new instance with the designated value.
* @exception ClassCastException if the designated value is not appropriate
* (see constructor with 3 arguments for suitable types of value).
*/
public static BMPString getInstance(ASNString value) {
return new BMPString("", value);
}
// Redefinition of methods in superclass Type
// .......................................................................
/**
* Decodes a BMPString from an input stream.
*
* @param is the ASN.1 stream to read from.
* @exception IOException if an exception occurs during the operation.
*/
public void decode(ASNReader is) throws IOException {
this.decodeInternal(is, Tag.BMP_STRING);
}
/**
* Encodes a BMPString to an output stream.
*
* @param os the ASN.1 stream to write to.
* @exception IOException if an exception occurs during the operation.
*/
public void encode(ASNWriter os) throws IOException {
this.encodeInternal(os, Tag.BMP_STRING);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -