net.rim.device.api.crypto.asn1
Class ASN1BitSet
java.lang.Object
net.rim.device.api.crypto.asn1.ASN1BitSet
- All Implemented Interfaces:
- Persistable
public class ASN1BitSet
- extends Object
- implements Persistable
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
.
- See Also:
ASN1InputStream
,
ASN1OutputStream
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
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. |
ASN1BitSet
public ASN1BitSet(byte[] data,
int size)
- Create a new
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.
- Parameters:
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 ).- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
append
public static ASN1BitSet append(ASN1BitSet bitSetOne,
ASN1BitSet bitSetTwo)
- Appends the contents of two ASN1BitSets together and returns the result.
- Parameters:
bitSetOne
- The ASN1BitSet to start with.bitsetTwo
- The ASN1BitSet to append to bitsetTwo.
- Returns:
- The new combined ASN1BitSet.
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
toByteArray
public byte[] toByteArray()
- Returns a copy of the byte array that underlies this bit set.
- Returns:
- The byte array.
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
getLength
public int getLength()
- Returns the number of bits represented by this bit set.
- Returns:
- An integer that represents the number of bits.
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
isSet
public boolean isSet(int index)
- Test if a particular bit is set, starting from index 0.
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
- Parameters:
index
- The index number of the bit to test.
- Returns:
- A boolean that returns true if the bit is set. Returns false otherwise.
- Throws:
ArrayIndexOutOfBoundsException
- Thrown if index
is not in the range
covered by bit set.- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
getNumSet
public int getNumSet()
- Retrieve the number of set bits in the collection.
- Returns:
- An integer that represents the number of set bits.
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
equals
public boolean equals(Object obj)
- Description copied from class:
Object
- Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation:
- It is reflexive: for any reference value
x
,
x.equals(x)
should return true
.
- It is symmetric: for any reference values
x
and
y
, x.equals(y)
should return
true
if and only if y.equals(x)
returns
true
.
- It is transitive: for any reference values
x
,
y
, and z
, if x.equals(y)
returns true
and y.equals(z)
returns
true
, then x.equals(z)
should return
true
.
- It is consistent: for any reference values
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.
- For any non-null reference value
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
).
- Overrides:
equals
in class Object
- Parameters:
obj
- the reference object with which to compare.
- Returns:
true
if this object is the same as the obj
argument; false
otherwise.- See Also:
Boolean.hashCode()
,
Hashtable
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
getNextSet
public int getNextSet(int index)
- Retrieve the next bit set starting at the given index. If
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
- Parameters:
index
- The first bit to check in ascending order.
- Returns:
- -1 if no more bits set, otherwise the index is returned.
- Throws:
ArrayIndexOutOfBoundsException
- If the index
was outside of the range for the bit set.- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
getPreviousSet
public int getPreviousSet(int index)
- Retrieve the previous bit set starting at the given index. If
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
- Parameters:
index
- The first bit to check in reverse order.
- Returns:
- -1 if no previous bits set, otherwise the index is returned.
- Throws:
ArrayIndexOutOfBoundsException
- If the index
was outside of the range for the bit set.- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
getFirstSet
public int getFirstSet()
- Retrieves the first bit set.
- Returns:
- Returns -1 if no bits set, otherwise returns the index.
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
getLastSet
public int getLastSet()
- Retrieves the last bit set.
- Returns:
- Returns -1 if no bits set, otherwise the index.
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 3.6.0
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.