public class Asn1Integer extends Asn1Type
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
MAX |
static java.lang.Object |
MIN |
static Asn1Tag |
TAG
The TAG constant describes the universal tag for
this data type (UNIVERSAL 2).
|
long |
value
This public member variable is where the integer value is
stored.
|
BIT_STRING, BMPString, BOOLEAN, DATE, DATE_TIME, DURATION, ENUMERATED, EOC, EXTERNAL, GeneralString, GeneralTime, GraphicString, IA5String, INTEGER, mNonParameterizedTypeName, NULL, NumericString, OBJECT_IDENTIFIER, ObjectDescriptor, OCTET_STRING, OID_IRI, OpenType, PrintableString, REAL, RELATIVE_OID_IRI, RelativeOID, SEQUENCE, SET, T61String, TeletexString, TIME, TIME_OF_DAY, UniversalString, UTCTime, UTF8String, VideotexString, VisibleString
Constructor and Description |
---|
Asn1Integer()
The default constructor sets the integer value to zero.
|
Asn1Integer(long value_)
This constructor creates an integer object from a integer value.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(Asn1BerDecodeBuffer buffer,
boolean explicit,
int implicitLength)
This method decodes an ASN.1 integer value including the UNIVERSAL
tag value and length if explicit tagging is specified.
|
void |
decode(Asn1JsonDecodeBuffer buffer)
Decode ASN.1 INTEGER from JSON.
|
void |
decode(Asn1OerDecodeBuffer buffer)
Decode this value as if unconstrained.
|
void |
decode(Asn1PerDecodeBuffer buffer)
This method decodes an unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
decode(Asn1PerDecodeBuffer buffer,
long lower,
long upper)
This method decodes a constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
decode(Asn1PerDecodeBuffer buffer,
long lower,
java.lang.Object upper)
This method decodes a semi-constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
decode(Asn1PerDecodeBuffer buffer,
java.lang.Object lower,
long upper)
This method decodes a unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
decode(Asn1PerDecodeBuffer buffer,
java.lang.Object lower,
java.lang.Object upper)
This method decodes a unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
decode16Bit(Asn1MderDecodeBuffer buffer,
boolean signed)
Decode a signed or unsigned 16-bit integer from an MDER encoding.
|
void |
decode32Bit(Asn1MderDecodeBuffer buffer,
boolean signed)
Decode a signed or unsigned 32-bit integer from an MDER encoding.
|
void |
decode8Bit(Asn1MderDecodeBuffer buffer,
boolean signed)
Decode a signed or unsigned 8-bit integer from an MDER encoding.
|
void |
decodeSigned(Asn1OerDecodeBuffer buffer)
Decode a variable-size signed integer, encoded with a length, into this
object, according to OER.
|
void |
decodeSigned(Asn1OerDecodeBuffer buffer,
int octets)
Decode a signed integer (2's complement) of the given length into this
object.
|
void |
decodeTallyMarks(Asn1NasDecodeBuffer buffer,
int bit)
Decode this integer's value by decoding "tally marks", where
the given bit value (0/1) is used for each tally mark and the negation
of the given bit marks the end of the tally marks.
|
void |
decodeTallyMarksPattern(Asn1NasDecodeBuffer buffer,
byte pattern)
Decode this integer's value by decoding "tally marks", where
the given bit pattern is used to determine the bit value to use for
each tally mark, according to the position within the buffer, and the
negation of a tally mark is used to mark the end of them.
|
void |
decodeUnsigned(Asn1OerDecodeBuffer buffer)
Decode a variable-size unsigned integer, encoded with a length, into this
object, according to OER.
|
void |
decodeUnsigned(Asn1OerDecodeBuffer buffer,
int octets)
Decode an unsigned integer (binary integer) of the given length into
this object.
|
static long |
decodeValue(Asn1PerDecodeBuffer buffer)
This method decodes an unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
static long |
decodeValue(Asn1PerDecodeBuffer buffer,
boolean retval)
This method decodes an unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
static long |
decodeValue(Asn1PerDecodeBuffer buffer,
long lower,
long upper)
This method decodes a constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
static long |
decodeValue(Asn1PerDecodeBuffer buffer,
long lower,
long upper,
boolean retval)
This method decodes a constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
decodeXER(java.lang.String buffer,
java.lang.String attrs)
This method decodes an ASN.1 integer value using the XML
encoding rules (XER).
|
void |
decodeXML(java.lang.String buffer,
java.lang.String attrs)
This method decodes an ASN.1 integer value using the XML
schema encoding rules.
|
int |
encode(Asn1BerEncodeBuffer buffer,
boolean explicit)
This method encodes an ASN.1 integer value including the UNIVERSAL
tag value and length if explicit tagging is specified.
|
void |
encode(Asn1BerOutputStream out,
boolean explicit)
This method encodes and writes to the stream an ASN.1 integer
value including the UNIVERSAL tag value and length if explicit
tagging is specified.
|
void |
encode(Asn1JsonOutputStream out)
Encode the value of this object as a JSON number.
|
void |
encode(Asn1OerEncodeBuffer buffer)
Encode this value as if unconstrained.
|
void |
encode(Asn1PerEncodeBuffer buffer)
This method encodes an unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerEncodeBuffer buffer,
long lower,
long upper)
This method encodes a constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerEncodeBuffer buffer,
long lower,
java.lang.Object upper)
This method encodes a semi-constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerEncodeBuffer buffer,
java.lang.Object lower,
long upper)
This method encodes a unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerEncodeBuffer buffer,
java.lang.Object lower,
java.lang.Object upper)
This method encodes a unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerOutputStream out)
This method encodes an unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerOutputStream out,
long lower,
long upper)
This method encodes a constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerOutputStream out,
long lower,
java.lang.Object upper)
This method encodes a semi-constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerOutputStream out,
java.lang.Object lower,
long upper)
This method encodes a unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1PerOutputStream out,
java.lang.Object lower,
java.lang.Object upper)
This method encodes a unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
void |
encode(Asn1XerEncoder buffer,
java.lang.String elemName)
This method encodes an ASN.1 integer value using the XML
encoding rules (XER).
|
void |
encode(Asn1XmlEncoder buffer,
java.lang.String elemName,
java.lang.String nsPrefix)
This method encodes an ASN.1 integer value using the XML
Encoding as specified in the XML schema standard(asn2xsd).
|
void |
encode16Bit(Asn1MderOutputStream out,
boolean signed)
This method encodes this ASN.1 INTEGER value to the MDER encoding.
|
void |
encode32Bit(Asn1MderOutputStream out,
boolean signed)
This method encodes this ASN.1 INTEGER value to the MDER encoding.
|
void |
encode8Bit(Asn1MderOutputStream out,
boolean signed)
This method encodes this ASN.1 INTEGER value to the MDER encoding.
|
void |
encodeAttribute(Asn1XmlEncoder buffer,
java.lang.String attrName)
This method encodes an ASN.1 integer value using the XML
Encoding as specified in the XML schema standard(asn2xsd).
|
void |
encodeBits(Asn1NasEncodeBuffer buffer,
int nbits)
Encode the lowest nbits bits of this integer's long value to the given
buffer.
|
void |
encodeMergeBits(Asn1NasEncodeBuffer buffer,
int nbits)
Encode the lowest nbits bits of this integer's long value to the given
buffer.
|
void |
encodeSigned(Asn1OerEncodeBuffer buffer)
Encode this value as a variable-size signed integer, with length,
according to OER.
|
void |
encodeSigned(Asn1OerEncodeBuffer buffer,
int octets)
Encode integer value as a signed value (2's complement) in the given
number of octets.
|
void |
encodeTallyMarks(Asn1NasEncodeBuffer buffer,
int bit)
Encode this integer's value by encoding as many "tally marks", where
the given bit value (0/1) is used for each tally mark and the negation
of the given bit marks the end of the tally marks.
|
void |
encodeTallyMarksPattern(Asn1NasEncodeBuffer buffer,
byte pattern)
Encode this integer's value by encoding as many "tally marks", where
the given bit pattern is used to determine the bit value to use for
each tally mark, according to the position within the buffer, and the
negation of a tally mark is used to mark the end of them.
|
void |
encodeUnsigned(Asn1OerEncodeBuffer buffer)
Encode this value as a variable-size unsigned integer, with length,
according to OER.
|
void |
encodeUnsigned(Asn1OerEncodeBuffer buffer,
int octets)
Encode integer value as an unsigned value (binary integer) in the given
number of octets, according to OER.
|
static void |
encodeValue(Asn1PerEncoder encoder,
long value,
long lower,
long upper)
This method encodes a constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
boolean |
equals(long lvalue)
This method compares this integer value to the given value
for equality.
|
boolean |
equals(java.lang.Object o)
This method compares this integer value to the given value
for equality.
|
java.lang.String |
getAsn1TypeName()
Returns the ASN.1 type name.
|
int |
getBitCount()
This method calculates the count of bits in the contained
integer value.
|
static int |
getBitCount(long ivalue)
This method calculates the count of bits in an integer value.
|
int |
getIntValue()
Return the value of the Asn1Integer as an int and throw an exception if
the value does not fit in an int.
|
int |
getUnsignedBitCount()
This method calculates the count of bits in the contained
unsigned integer value.
|
static int |
getUnsignedBitCount(long ivalue)
This method calculates the count of bits in an unsigned integer value.
|
int |
hashCode()
This method returns the hash code for this integer value.
|
static void |
skip(Asn1PerDecodeBuffer buffer)
This method skips an unconstrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
static void |
skip(Asn1PerDecodeBuffer buffer,
long lower,
long upper)
This method skips a constrained ASN.1 integer value using
the Packed Encoding Rules (PER).
|
java.lang.String |
toString()
This method will return a string representation of the integer value.
|
_setKey, _setLicLocation, clone, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, encode, encode, encode, encode, encode, encodeAsOpenType, equals, getLength, getNonParameterizedTypeName, getTypeName, indent, indent, isOpenType, matchTag, matchTag, pdiag, print, print, print, setNonParameterizedTypeName, setOpenType
public static final java.lang.Object MIN
public static final java.lang.Object MAX
public static final Asn1Tag TAG
public transient long value
public Asn1Integer()
public Asn1Integer(long value_)
value_
- Integer valuepublic java.lang.String getAsn1TypeName()
getAsn1TypeName
in class Asn1Type
public final int getIntValue()
public void decode(Asn1BerDecodeBuffer buffer, boolean explicit, int implicitLength) throws Asn1Exception, java.io.IOException
decode
in interface Asn1TypeIF
decode
in class Asn1Type
buffer
- Decode message buffer objectexplicit
- Flag indicating element is explicitly taggedimplicitLength
- Length of contents if implicitAsn1Exception
java.io.IOException
public int encode(Asn1BerEncodeBuffer buffer, boolean explicit) throws Asn1Exception
encode
in interface Asn1TypeIF
encode
in class Asn1Type
buffer
- Encode message buffer objectexplicit
- Flag indicating explicit tagging should be doneAsn1Exception
public void decode(Asn1PerDecodeBuffer buffer) throws Asn1Exception, java.io.IOException
decode
in interface Asn1TypeIF
decode
in class Asn1Type
buffer
- PER Decode message buffer objectAsn1Exception
java.io.IOException
public static long decodeValue(Asn1PerDecodeBuffer buffer) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectAsn1Exception
java.io.IOException
public static long decodeValue(Asn1PerDecodeBuffer buffer, boolean retval) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectretval
- If true, return the decoded value; else return 0.Asn1Exception
java.io.IOException
public static long decodeValue(Asn1PerDecodeBuffer buffer, long lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectlower
- Lower bound of the integer rangeupper
- Upper bound of the integer rangeAsn1Exception
java.io.IOException
public static long decodeValue(Asn1PerDecodeBuffer buffer, long lower, long upper, boolean retval) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectlower
- Lower bound of the integer rangeupper
- Upper bound of the integer rangeretval
- If true, return the decoded result; else return 0.Asn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, long lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectlower
- Lower bound of the integer rangeupper
- Upper bound of the integer rangeAsn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, java.lang.Object lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectlower
- Lower bound equal MINupper
- Upper bound of the integer rangeAsn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, long lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectlower
- Lower bound of the integer rangeupper
- Upper bound equal MAXAsn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, java.lang.Object lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectlower
- Lower bound equal MINupper
- Upper bound equal MAXAsn1Exception
java.io.IOException
public static void skip(Asn1PerDecodeBuffer buffer) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectAsn1Exception
java.io.IOException
public static void skip(Asn1PerDecodeBuffer buffer, long lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- PER Decode message buffer objectlower
- Lower bound of the integer rangeupper
- Upper bound of the integer rangeAsn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer) throws Asn1Exception, java.io.IOException
encode
in interface Asn1TypeIF
encode
in class Asn1Type
buffer
- PER Encode message buffer objectAsn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer, long lower, long upper) throws Asn1Exception
buffer
- PER Encode message buffer objectlower
- Lower bound (inclusive) of integer being encodedupper
- Upper bound (inclusive) of integer being encodedAsn1Exception
public static void encodeValue(Asn1PerEncoder encoder, long value, long lower, long upper) throws Asn1Exception
encoder
- PER Encoder objectvalue
- The value to encodelower
- Lower bound (inclusive) of integer being encodedupper
- Upper bound (inclusive) of integer being encodedAsn1Exception
public void encode(Asn1PerEncodeBuffer buffer, java.lang.Object lower, long upper) throws Asn1Exception
buffer
- PER Encode message buffer objectlower
- Lower bound equal MINupper
- Upper bound (inclusive) of integer being encodedAsn1Exception
public void encode(Asn1PerEncodeBuffer buffer, long lower, java.lang.Object upper) throws Asn1Exception
buffer
- PER Encode message buffer objectlower
- Lower bound (inclusive) of integer being encodedupper
- Upper bound equal MAXAsn1Exception
public void encode(Asn1PerEncodeBuffer buffer, java.lang.Object lower, java.lang.Object upper) throws Asn1Exception
buffer
- PER Encode message buffer objectlower
- Lower bound equal MINupper
- Upper bound equal MAXAsn1Exception
public final void decodeSigned(Asn1OerDecodeBuffer buffer, int octets) throws java.io.IOException
octets
- The number of octets in which the value was encoded.
0 < octets <= 8java.io.IOException
public final void decodeUnsigned(Asn1OerDecodeBuffer buffer, int octets) throws java.io.IOException
octets
- The number of octets in which the value was encoded.
0 < octets <= 8java.io.IOException
public final void decodeSigned(Asn1OerDecodeBuffer buffer) throws java.io.IOException
java.io.IOException
public final void decodeUnsigned(Asn1OerDecodeBuffer buffer) throws java.io.IOException
java.io.IOException
public void decode(Asn1OerDecodeBuffer buffer) throws java.io.IOException
public final void encodeSigned(Asn1OerEncodeBuffer buffer)
public final void encodeUnsigned(Asn1OerEncodeBuffer buffer)
public void encode(Asn1OerEncodeBuffer buffer) throws java.io.IOException
public final void encodeSigned(Asn1OerEncodeBuffer buffer, int octets)
buffer
- The buffer.octets
- The number of octets to encode in: 1, 2, 4, or 8.public final void encodeUnsigned(Asn1OerEncodeBuffer buffer, int octets)
buffer
- The buffer.octets
- The number of octets to encode in: 1, 2, 4, or 8.public final void decodeTallyMarks(Asn1NasDecodeBuffer buffer, int bit) throws java.io.IOException
java.lang.IllegalArgumentException
- if this value is negativejava.io.IOException
public final void decodeTallyMarksPattern(Asn1NasDecodeBuffer buffer, byte pattern) throws java.io.IOException
java.io.IOException
public final void encodeTallyMarks(Asn1NasEncodeBuffer buffer, int bit)
java.lang.IllegalArgumentException
- if this value is negativepublic final void encodeTallyMarksPattern(Asn1NasEncodeBuffer buffer, byte pattern)
java.lang.IllegalArgumentException
- if this value is negativepublic final void encodeBits(Asn1NasEncodeBuffer buffer, int nbits)
buffer
- nbits
- public final void encodeMergeBits(Asn1NasEncodeBuffer buffer, int nbits)
buffer
- nbits
- public void decode8Bit(Asn1MderDecodeBuffer buffer, boolean signed) throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public void decode16Bit(Asn1MderDecodeBuffer buffer, boolean signed) throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public void decode32Bit(Asn1MderDecodeBuffer buffer, boolean signed) throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public void encode(Asn1XerEncoder buffer, java.lang.String elemName) throws java.io.IOException, Asn1Exception
encode
in interface Asn1TypeIF
encode
in class Asn1Type
buffer
- Encode message buffer objectelemName
- Element namejava.io.IOException
- Any exception thrown by the underlying stream.Asn1Exception
- Thrown, if operation is failed.public void decodeXER(java.lang.String buffer, java.lang.String attrs) throws Asn1Exception
buffer
- String containing data to be decodedattrs
- Attributes string from element tagAsn1Exception
public void encode(Asn1XmlEncoder buffer, java.lang.String elemName, java.lang.String nsPrefix) throws java.io.IOException, Asn1Exception
public void encodeAttribute(Asn1XmlEncoder buffer, java.lang.String attrName) throws Asn1Exception, java.io.IOException
buffer
- Encode message buffer objectattrName
- Attribute nameAsn1Exception
java.io.IOException
public void decodeXML(java.lang.String buffer, java.lang.String attrs) throws Asn1Exception
decodeXML
in interface Asn1TypeIF
decodeXML
in class Asn1Type
buffer
- String containing data to be decodedattrs
- Attributes string from element tagAsn1Exception
public void decode(Asn1JsonDecodeBuffer buffer) throws java.io.IOException
public void encode(Asn1JsonOutputStream out) throws java.io.IOException
public boolean equals(long lvalue)
lvalue
- Integer test valuepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Asn1Integer object containing value to comparepublic int hashCode()
public static int getBitCount(long ivalue)
ivalue
- Integer value in which to count bits.public int getBitCount()
public static int getUnsignedBitCount(long ivalue)
ivalue
- Integer value in which to count bits.public int getUnsignedBitCount()
public java.lang.String toString()
toString
in class java.lang.Object
public void encode(Asn1BerOutputStream out, boolean explicit) throws Asn1Exception, java.io.IOException
encode
in interface Asn1TypeIF
encode
in class Asn1Type
out
- BER Output Stream objectexplicit
- Flag indicating explicit tagging should be donejava.io.IOException
- Any exception thrown by the underlying OutputStream.Asn1Exception
- Thrown, if operation is failed.public void encode(Asn1PerOutputStream out) throws Asn1Exception, java.io.IOException
encode
in interface Asn1TypeIF
encode
in class Asn1Type
out
- PER Encode message buffer objectjava.io.IOException
- Any exception thrown by the Asn1PerOutputStream.Asn1Exception
- Thrown, if operation is failed.public void encode(Asn1PerOutputStream out, long lower, long upper) throws Asn1Exception, java.io.IOException
out
- PER Encode message buffer objectlower
- Lower bound (inclusive) of integer being encodedupper
- Upper bound (inclusive) of integer being encodedjava.io.IOException
- Any exception thrown by the Asn1PerOutputStream.Asn1Exception
- Thrown, if operation is failed.public void encode(Asn1PerOutputStream out, java.lang.Object lower, long upper) throws Asn1Exception, java.io.IOException
out
- PER Encode message buffer objectlower
- Lower bound equal MINupper
- Upper bound (inclusive) of integer being encodedAsn1Exception
java.io.IOException
public void encode(Asn1PerOutputStream out, long lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
out
- PER Encode message buffer objectlower
- Lower bound (inclusive) of integer being encodedupper
- Upper bound equal MAXAsn1Exception
java.io.IOException
public void encode(Asn1PerOutputStream out, java.lang.Object lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
out
- PER Encode message buffer objectlower
- Lower bound equal MINupper
- Upper bound equal MAXAsn1Exception
java.io.IOException
public final void encode8Bit(Asn1MderOutputStream out, boolean signed) throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public final void encode16Bit(Asn1MderOutputStream out, boolean signed) throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException
public final void encode32Bit(Asn1MderOutputStream out, boolean signed) throws Asn1Exception, java.io.IOException
Asn1Exception
java.io.IOException