net.rim.device.api.crypto.asn1
Class ASN1BitSet

java.lang.Object
  extended by 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
Category: Signed ASN1BitSet(byte[] data, int size)
          Create a new ASN1BitSet instance.
 
Method Summary
Category: Signed static ASN1BitSet append(ASN1BitSet bitSetOne, ASN1BitSet bitSetTwo)
          Appends the contents of two ASN1BitSets together and returns the result.
Category: Signed  boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
Category: Signed  int getFirstSet()
          Retrieves the first bit set.
Category: Signed  int getLastSet()
          Retrieves the last bit set.
Category: Signed  int getLength()
          Returns the number of bits represented by this bit set.
Category: Signed  int getNextSet(int index)
          Retrieve the next bit set starting at the given index.
Category: Signed  int getNumSet()
          Retrieve the number of set bits in the collection.
Category: Signed  int getPreviousSet(int index)
          Retrieve the previous bit set starting at the given index.
Category: Signed  boolean isSet(int index)
          Test if a particular bit is set, starting from index 0.
Category: Signed  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

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


Method Detail

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:

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.