|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.asn1.ASN1Object | +--iaik.asn1.INTEGER
This class implements the native ASN.1 type "INTEGER". INTEGER is a simple non-string ASN.1 type identified by the UNIVERSAL TAG number 2. An ASN.1 INTEGER object may represent any arbitrary integer value.
When creating a new ASN.1 INTEGER object, an application may supply
the integer value either as Java int
value or as Java
BigInteger
object,e.g.:
int value = ...; INTEGER asn1Integer = new INTEGER(value); //or BigInteger value = ...; INTEGER asn1Integer = new INTEGER(value);When calling the
getValue
method for getting the inherent value
from an ASN.1 INTEGER instance, a Java object of type BigInteger
is returned:
BigInteger Value = (BigInteger)asn1Integer.getValue(); int value = Value.intValue();DER en/decoding generally is done by means of the several methods of the
DerCoder
class; decoding alternatively may be performed by
using the DerInputStream
utility.
ASN1Object
,
ASN
Fields inherited from class iaik.asn1.ASN1Object |
asnType, constructed, encode_listener, indefinite_length, isStringType, stream_mode |
Constructor Summary | |
protected |
INTEGER()
Creates an empty INTEGER. |
|
INTEGER(BigInteger value)
Creates a new ASN.1 INTEGER object for the given Java BigInteger value. |
|
INTEGER(int value)
Creates a new ASN.1 INTEGER object for the given Java int value. |
Method Summary | |
protected void |
decode(int length,
InputStream is)
Decodes an INTEGER value from the given InputStream. |
protected void |
encode(OutputStream os)
DER encodes this INTEGER ASN1Object and writes the result to the given OutputStream. |
Object |
getValue()
Returns the value of this INTEGER as a BigInteger object. |
void |
setValue(Object value)
Sets the value of this INTEGER. |
String |
toString()
Returns a string that represents the contents of this INTEGER ASN1Object. |
Methods inherited from class iaik.asn1.ASN1Object |
addComponent, addEncodeListener, clone, countComponents, encodeObject, getAsnType, getComponentAt, indefiniteLength, isA, isConstructed, isStringType, setIndefiniteLength |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected INTEGER()
public INTEGER(BigInteger value)
value
- the BigInteger value this INTEGER object should representpublic INTEGER(int value)
value
- the int value this INTEGER object should representMethod Detail |
public Object getValue()
getValue
in class ASN1Object
public void setValue(Object value)
BigInteger
.setValue
in class ASN1Object
value
- the Java BigInteger value to be set for this INTEGER objectprotected void encode(OutputStream os) throws IOException
encode
methods of the
DerCoder
class for performing
the encoding, and the DerCoder internally will call this
encode
method.encode
in class ASN1Object
os
- the output stream to which to write the dataIOException
- if an I/O error occurs while writing to the streamprotected void decode(int length, InputStream is) throws IOException
length
bytes to be read represent the value of an
ASN.1 object of type INTEGER.
This is a protected method and will not be used by
an application for decoding a DER encoded INTEGER. An application
will call one of the decode
methods of the
DerCoder
class for performing
the decoding. The DerCoder then determines the number of
bytes (length
) occupied by the value of this INTEGER
object and internally calls this decode
method for actually reading the value.
decode
in class ASN1Object
length
- the already decoded length, i.e. number of the bytes representing the
value of the INTEGER to be decodedis
- the input stream from which the DER decoded data is read inIOException
- if there is a problem with the InputStreampublic String toString()
toString
in class ASN1Object
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |