|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.crypto.asn1.ASN1BitSet
public class ASN1BitSet
Implements the Abstract Syntax Notation One (ASN1) functionality. ASN1BitSet is an immutable collection of bits. This class is returned
by the call in ASN1InputStream.readBitString.
ASN1InputStream,
ASN1OutputStream| Constructor Summary | ||
|---|---|---|
|
ASN1BitSet(byte[] data,
int size)
Create a new ASN1BitSet instance. |
|
| Method Summary | ||
|---|---|---|
|
static ASN1BitSet |
append(ASN1BitSet bitSetOne,
ASN1BitSet bitSetTwo)
Appends the contents of two ASN1BitSets together and returns the result. |
|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
|
int |
getFirstSet()
Retrieves the first bit set. |
|
int |
getLastSet()
Retrieves the last bit set. |
|
int |
getLength()
Returns the number of bits represented by this bit set. |
|
int |
getNextSet(int index)
Retrieve the next bit set starting at the given index. |
|
int |
getNumSet()
Retrieve the number of set bits in the collection. |
|
int |
getPreviousSet(int index)
Retrieve the previous bit set starting at the given index. |
|
boolean |
isSet(int index)
Test if a particular bit is set, starting from index 0. |
|
byte[] |
toByteArray()
Returns a copy of the byte array that underlies this bit set. |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ASN1BitSet(byte[] data,
int size)
ASN1BitSet instance. Note that only a reference to data is
stored in this class, not a copy of the array.
This assumes that bits in data are indexed from the left-most bit to the right most bit ( network-byte
order ) and that the low order bits are found in data[0]
ie. byte = 0x51 has the following bits set : 1, 3, 7.
data - The byte array storing the bits.size - The number of bits in the byte array ( must not differ by more than 7 bits from data.length ).| Method Detail |
|---|
public static ASN1BitSet append(ASN1BitSet bitSetOne,
ASN1BitSet bitSetTwo)
bitSetOne - The ASN1BitSet to start with.bitsetTwo - The ASN1BitSet to append to bitsetTwo.
public byte[] toByteArray()
public int getLength()
public boolean isSet(int index)
This assumes that the bits are indexed from the left-most bit to the right most bit ( network-byte order ) and that the low order bits are found at array index 0, in the backing byte array.
ie. byte = 0x51 has the following bits set : 1, 3, 7
index - The index number of the bit to test.
ArrayIndexOutOfBoundsException - Thrown if index is not in the range
covered by bit set.public int getNumSet()
public boolean equals(Object obj)
Object
The equals method implements an equivalence relation:
x,
x.equals(x) should return true.
x and
y, x.equals(y) should return
true if and only if y.equals(x) returns
true.
x,
y, and z, if x.equals(y)
returns true and y.equals(z) returns
true, then x.equals(z) should return
true.
x
and y, multiple invocations of x.equals(y)
consistently return true or consistently return
false, provided no information used in
equals comparisons on the object is modified.
x,
x.equals(null) should return false.
The equals method for class Object implements
the most discriminating possible equivalence relation on objects;
that is, for any reference values x and y,
this method returns true if and only if x and
y refer to the same object (x==y has the
value true).
equals in class Objectobj - the reference object with which to compare.
true if this object is the same as the obj
argument; false otherwise.Boolean.hashCode(),
Hashtablepublic int getNextSet(int index)
index is set, index will be returned.
This assumes that the bits are indexed from the left-most bit to the right most bit ( network-byte order ) and that the low order bits are found at array index 0, in the backing byte array.
ie. byte = 0x51 has the following bits set : 1, 3, 7
index - The first bit to check in ascending order.
ArrayIndexOutOfBoundsException - If the index was outside of the range for the bit set.public int getPreviousSet(int index)
index is set, index will be returned.
This assumes that the bits are indexed from the left-most bit to the right most bit ( network-byte order ) and that the low order bits are found at array index 0, in the backing byte array.
ie. byte = 0x51 has the following bits set : 1, 3, 7
index - The first bit to check in reverse order.
ArrayIndexOutOfBoundsException - If the index was outside of the range for the bit set.public int getFirstSet()
public int getLastSet()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.