|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objsys.asn1j.runtime.Asn1Type com.objsys.asn1j.runtime.Asn1BitString
public class Asn1BitString
This is a container class for holding the components of an ASN.1 bit string value.
Field Summary | |
---|---|
static short |
ASN1VALUE
The ASN1VALUE constant describes the string format for hex or binary digit value. |
static short |
BITS
The BITS constant describes the string format for binary digit value (e.g. only 0 and 1 digits). |
static short |
HEX
The HEX constant describes the string format for hex digit value (e.g. 0123456789ABCDEF). |
static short |
HEXBIN
The HEXBIN constant describes the string format for hex or binary digit value (e.g. 0xAA 10xxxxxx). |
static short |
mStringFormat
The mStringFormat variable can be used to set the string format for print or event handler or toString() functions. |
int |
numbits
This variable contains the number of bits in the bit string value. |
static Asn1Tag |
TAG
The TAG constant describes the universal tag for this data type (UNIVERSAL 3). |
boolean |
trimZeroBits
This variable describes whether trailing zero bits should be truncated. |
byte[] |
value
This variable holds the bit string value. |
Fields inherited from class com.objsys.asn1j.runtime.Asn1Type |
---|
BIT_STRING, BMPString, BOOLEAN, DATE, DATE_TIME, DURATION, ENUMERATED, EOC, EXTERNAL, GeneralString, GeneralTime, GraphicString, IA5String, INTEGER, mAsn1TypeName, 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 Summary | |
---|---|
Asn1BitString()
This constructor creates an empty bit string that can be used in a decode method call to receive a bit string value. |
|
Asn1BitString(java.util.BitSet bitSet)
This constructor initializes a bit string from the given BitSet object. |
|
Asn1BitString(boolean[] bitValues)
This constructor initializes a bit string from the given boolean array. |
|
Asn1BitString(byte[] data)
This constructor initializes a bit string with the given bytes, using all 8 bits of every byte. |
|
Asn1BitString(int numbits_,
byte[] data)
This constructor initializes a bit string with the given number of bits and data. |
|
Asn1BitString(java.lang.String value_)
This constructor parses the given ASN.1 value text (either a binary or hex data string) and assigns the values to the internal bit string. |
Method Summary | |
---|---|
void |
clear(int bitno)
This method clears the given bit in the bit string. |
void |
decode(Asn1BerDecodeBuffer buffer,
boolean explicit,
int implicitLength)
This method decodes an ASN.1 bit string value using the BER or DER encoding rules. |
void |
decode(Asn1JsonDecodeBuffer buffer)
Decode ASN.1 bit string from JSON. |
void |
decode(Asn1MderDecodeBuffer buffer,
int length)
Decode a BIT STRING from the MDER encoding into this object. |
void |
decode(Asn1PerDecodeBuffer buffer)
This method decodes an ASN.1 bit string value using the packed encoding rules (PER). |
void |
decode(Asn1PerDecodeBuffer buffer,
long lower,
long upper)
This method decodes a sized ASN.1 bit string value using the packed encoding rules (PER). |
void |
decode(Asn1PerDecodeBuffer buffer,
long lower,
java.lang.Object upper)
This method decodes a sized ASN.1 bit string value using the packed encoding rules (PER). |
void |
decode(Asn1PerDecodeBuffer buffer,
java.lang.Object lower,
long upper)
This method decodes a sized ASN.1 bit string value using the packed encoding rules (PER). |
void |
decode(Asn1PerDecodeBuffer buffer,
java.lang.Object lower,
java.lang.Object upper)
This method decodes a sized ASN.1 bit string value using the packed encoding rules (PER). |
void |
decodeXER(java.lang.String buffer,
java.lang.String attrs)
This method decodes ASN.1 8-bit character string types including IA5String, PrintableString, NumericString, etc. |
void |
decodeXML(java.lang.String buffer,
java.lang.String attrs)
This method decodes an ASN.1 BIT STRING using the XML schema encoding rules. |
int |
encode(Asn1BerEncodeBuffer buffer,
boolean explicit)
This method encodes an ASN.1 bit string value using the BER or DER encoding rules. |
void |
encode(Asn1BerOutputStream out,
boolean explicit)
This method encodes and writes to the stream an ASN.1 bit string value including the UNIVERSAL tag value and length if explicit tagging is specified. |
void |
encode(Asn1JsonOutputStream outstream)
Encode this bit string to JSON. |
void |
encode(Asn1MderOutputStream out,
int length)
Encode this BIT STRING into the MDER encoding. |
void |
encode(Asn1PerEncodeBuffer buffer)
This method encodes an unconstrained ASN.1 bit string value using the packed encoding rules (PER). |
void |
encode(Asn1PerEncodeBuffer buffer,
long lower,
long upper)
This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER). |
void |
encode(Asn1PerEncodeBuffer buffer,
long lower,
java.lang.Object upper)
This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER). |
void |
encode(Asn1PerEncodeBuffer buffer,
java.lang.Object lower,
long upper)
This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER). |
void |
encode(Asn1PerEncodeBuffer buffer,
java.lang.Object lower,
java.lang.Object upper)
This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER). |
void |
encode(Asn1PerOutputStream out)
This method encodes an unconstrained ASN.1 bit string value using the packed encoding rules (PER)into the stream. |
void |
encode(Asn1PerOutputStream out,
long lower,
long upper)
This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER) into the stream. |
void |
encode(Asn1XerEncoder buffer,
java.lang.String elemName)
This method encodes ASN.1 bit string type using the XML encoding rules (XER). |
void |
encode(Asn1XmlEncoder buffer,
java.lang.String elemName,
java.lang.String nsPrefix)
This method encodes ASN.1 bit string type using the XML Encoding as specified in the XML schema standard. |
void |
encode(Asn1XmlEncoder buffer,
java.lang.String elemName,
java.lang.String nsPrefix,
java.lang.String[] namedbits,
int[] namedbitindex)
This method encodes ASN.1 bit string type using the XML Encoding as specified in the XML schema standard. |
boolean |
equals(int nbits,
byte[] value)
This method compares this bit string value to the given value for equality. |
boolean |
equals(java.lang.Object bs_)
This method compares this bit string value to the given value for equality. |
java.lang.String |
getAsn1TypeName()
This method gets the ASN.1 type name. |
int |
getLength()
This method will return the length of the BIT STRING in bits. |
int |
hashCode()
This method returns the hashCode for this bit string. |
boolean |
isNamedBitStr(java.lang.String buffer)
This method determines is the input character string represented as named bit string or as bits sequence. |
boolean |
isSet(int bitno)
This method tests if the given bit in the bit string is set or not. |
void |
set(int bitno)
This method will set the given bit number to one (1). |
void |
set(int bitno,
boolean bvalue)
This method will set the given bit number to the given boolean value. |
boolean[] |
toBoolArray()
This method converts the bit string stored in this object to a boolean array. |
java.lang.String |
toHexString()
This method will return a hex string representation of the bit string value. |
java.io.InputStream |
toInputStream()
This method will return a byte array input stream representation of the bit string value. |
java.lang.String |
toString()
This method will return a string representation of the BIT STRING value. |
Methods inherited from class com.objsys.asn1j.runtime.Asn1Type |
---|
clone, decode, decode, decode, decode, decode, encode, encode, equals, getTypeName, indent, isOpenType, matchTag, matchTag, pdiag, print, setKey, setOpenType |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Asn1Tag TAG
public static final short HEX
public static final short BITS
public static final short ASN1VALUE
public static final short HEXBIN
public static short mStringFormat
public transient int numbits
public transient byte[] value
public boolean trimZeroBits
Constructor Detail |
---|
public Asn1BitString()
public Asn1BitString(int numbits_, byte[] data)
numbits_
- Number of bitsdata
- Binary bit string contentspublic Asn1BitString(byte[] data)
data
- Binary bit string contentspublic Asn1BitString(boolean[] bitValues)
bitValues
- The boolean arraypublic Asn1BitString(java.lang.String value_) throws Asn1ValueParseException
value_
- The ASN.1 value specification text
Asn1ValueParseException
public Asn1BitString(java.util.BitSet bitSet)
bitSet
- Java BitSet objectMethod Detail |
---|
public java.lang.String getAsn1TypeName()
getAsn1TypeName
in class Asn1Type
public void clear(int bitno)
bitno
- Number of bit to clear. Bit numbers start at
zero and with the MSB of the first byte and
progress from left to right.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 implicit
Asn1Exception
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 done
Asn1Exception
public void decode(Asn1PerDecodeBuffer buffer) throws Asn1Exception, java.io.IOException
decode
in interface Asn1TypeIF
decode
in class Asn1Type
buffer
- Decode message buffer object
Asn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, long lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- Decode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, long lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
buffer
- Decode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, java.lang.Object lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- Decode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void decode(Asn1PerDecodeBuffer buffer, java.lang.Object lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
buffer
- Decode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer) throws Asn1Exception, java.io.IOException
encode
in interface Asn1TypeIF
encode
in class Asn1Type
buffer
- Encode message buffer object
Asn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer, long lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- Encode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer, long lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
buffer
- Encode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer, java.lang.Object lower, long upper) throws Asn1Exception, java.io.IOException
buffer
- Encode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer, java.lang.Object lower, java.lang.Object upper) throws Asn1Exception, java.io.IOException
buffer
- Encode message buffer objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
Asn1Exception
java.io.IOException
public void decode(Asn1MderDecodeBuffer buffer, int length) throws Asn1Exception, java.io.IOException
length
- This should be 8, 16, or 32, as these are the only lengths
MDER supports. However, this is not checked here as it should be able
to be checked at code generation time.
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
- XML element name used to wrap string
java.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 tag
Asn1Exception
public void encode(Asn1XmlEncoder buffer, java.lang.String elemName, java.lang.String nsPrefix, java.lang.String[] namedbits, int[] namedbitindex) throws java.io.IOException, Asn1Exception
buffer
- Encode message buffer objectelemName
- XML element name used to wrap stringnsPrefix
- XML element name space prefixnamedbits
- Array of named bitsnamedbitindex
- Arrat of named bits index values
java.io.IOException
Asn1Exception
public void encode(Asn1XmlEncoder buffer, java.lang.String elemName, java.lang.String nsPrefix) throws java.io.IOException, Asn1Exception
buffer
- Encode message buffer objectelemName
- XML element name used to wrap stringnsPrefix
- XML element namespace prefix
java.io.IOException
Asn1Exception
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 tag
Asn1Exception
public boolean isNamedBitStr(java.lang.String buffer)
buffer
- Bit string as string to be tested.
public void decode(Asn1JsonDecodeBuffer buffer) throws java.io.IOException
buffer
-
java.io.IOException
public void encode(Asn1JsonOutputStream outstream) throws java.io.IOException
outstream
-
java.io.IOException
public boolean equals(int nbits, byte[] value)
nbits
- Number of bitsvalue
- Byte array containing bit datapublic boolean equals(java.lang.Object bs_)
equals
in class java.lang.Object
bs_
- Bit string object to compare for equalitypublic int hashCode()
hashCode
in class Asn1Type
public int getLength() throws Asn1InvalidLengthException
getLength
in class Asn1Type
Asn1InvalidLengthException
public boolean isSet(int bitno)
bitno
- Number of bit to set. Bit numbers start at zero and
with the MSB of the first byte and progress from
left to right.
public boolean[] toBoolArray()
public void set(int bitno, boolean bvalue)
bitno
- Number of bit to set. Bit numbers start at zero and
with the MSB of the first byte and progress from
left to right.bvalue
- Bit value (true or false)public void set(int bitno)
bitno
- Number of bit to set. Bit numbers start at zero and
with the MSB of the first byte and progress from
left to right.public java.io.InputStream toInputStream()
public java.lang.String toHexString()
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 done
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 Output Stream object
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 Output Stream objectlower
- Lower bound (inclusive) of size constraintupper
- Upper bound (inclusive) of size constraint
IOException
- Any exception thrown by the Asn1PerOutputStream.
Asn1Exception
- Thrown, if operation is failed.public void encode(Asn1MderOutputStream out, int length) throws Asn1Exception, java.io.IOException
length
- This should be 8, 16, or 32, as these are the only lengths
MDER supports. However, this is not checked here as it should be able
to be checked at code generation time. We only check here that the
actual and given lengths match.
Asn1Exception
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |