|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpasn.misc.ASN1BitStringValue
public final class ASN1BitStringValue
Constructor Summary | |
---|---|
ASN1BitStringValue()
|
|
ASN1BitStringValue(byte[] value)
|
|
ASN1BitStringValue(byte[] value,
int unusedBits)
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
|
int |
getNumberOfBits()
Returns the number of significant bits stored in this BIT STRING |
int |
getNumberOfOctets()
|
int |
getUnusedBits()
|
byte[] |
getValue()
|
boolean |
hasBitValue(int bitIndex)
Checks that the given index is valid |
boolean |
isBitReset(int bitIndex)
Checks that the bit located at the given index is reset (has value 0) |
boolean |
isBitSet(int bitIndex)
Checks that the bit located at the given index is set (has value 1) |
void |
reset()
Removes the value (or list or set of values) of this ASN.1 object. |
void |
setUnusedBits(int unusedBits)
Initializes the number of unused bits of this BIT STRING. |
void |
setValue(boolean[] value)
Initializes the value of this BIT STRING using the given value array. |
boolean |
setValue(boolean bitValue,
int bitIndex)
Sets or resets the bit located at the given index. |
void |
setValue(byte[] value)
Initializes the value of this BIT STRING along with no unused (extra) bits |
void |
setValue(byte[] value,
int unusedBits)
Initializes the value of this BIT STRING along with unused bits |
void |
setValue(java.lang.String value)
Initializes the value of this BIT STRING using the given string representation of bit values. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ASN1BitStringValue()
public ASN1BitStringValue(byte[] value)
public ASN1BitStringValue(byte[] value, int unusedBits)
Method Detail |
---|
public int getUnusedBits()
public byte[] getValue()
public void setValue(byte[] value)
Initializes the value of this BIT STRING along with no unused (extra) bits
value
- The byte array to initialize this BIT STRING
with. This byte array must be considered as a list of bit values. A
null value re-initializes this BIT STRINGpublic void setValue(byte[] value, int unusedBits)
Initializes the value of this BIT STRING along with unused bits
value
- The byte array to initialize this BIT STRING
with. This byte array must be considered as a list of bit values. A
null value re-initializes this BIT STRINGunusedBits
- The number of unused bits, from range 0 (all
bits are necessary) to 7 (all but the first bit of the last
octet are not used). A negative number is changed to 0 and any
value greater than 7 is transformed so that it fits in the
required range (modulo 8 mathematical transformation is performed)public void setValue(boolean[] value)
Initializes the value of this BIT STRING using the given value array. The number of unused bits is automatically initialized, depending on the length of this array
value
- A possibly null array of boolean values. Each
value corresponds to a bit value: false stands for 0
(bit reset) and true for 1 (bit set)public void setValue(java.lang.String value)
Initializes the value of this BIT STRING using the given string representation of bit values. The number of unused bits is also initialized
value
- Any string (possibly null or empty) composed of
'0' and '1' characters, such as
"001001011"public boolean setValue(boolean bitValue, int bitIndex)
Sets or resets the bit located at the given index. The internal value is automatically resized in case the bit index is outsize the length of the current value
bitValue
- True means that the specified bit has to be
set (takes value 1), false resets this bit
(changes its value to 0)bitIndex
- The index (starting at 0, without
-theorically- maximum limitation) of the bit that must be set. A negative
value has no effect and this BIT STRING is left unchanged
public int getNumberOfBits()
Returns the number of significant bits stored in this BIT STRING
public int getNumberOfOctets()
public void setUnusedBits(int unusedBits)
Initializes the number of unused bits of this BIT STRING. Changing this number does not affect the current bits values of this BIT STRING
unusedBits
- Any number in range [0..7]. A negative
number is changed to 0 and a number greater than 7
is transformed using a modulo operation so that it fits in the required
range of values: 12 is thus transformed to 12 % 8 = 4public boolean isBitSet(int bitIndex)
Checks that the bit located at the given index is set (has value 1)
bitIndex
- A number in range
[0..getNumberOfBits()
[
hasBitValue(int)
public boolean isBitReset(int bitIndex)
Checks that the bit located at the given index is reset (has value 0)
bitIndex
- A number in range
[0..getNumberOfBits()
[
hasBitValue(int)
public boolean hasBitValue(int bitIndex)
Checks that the given index is valid
bitIndex
- Any number
getNumberOfBits()
[,
false if either this BIT STRING is not initialized
or the given index value is out of rangepublic void reset()
ASN1Resetable
Removes the value (or list or set of values) of this ASN.1 object. This applies to simple and structured ASN.1 objects
reset
in interface ASN1Resetable
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |