net.rim.device.api.util
Class ContentProtectedVector

java.lang.Object
  extended by java.util.Vector
      extended by net.rim.device.api.util.ContentProtectedVector
All Implemented Interfaces:
PersistentContentListener, Persistable

public class ContentProtectedVector
extends Vector
implements Persistable, PersistentContentListener

Provides a vector that employs content protection on its contained elements.

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 4.0.0

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from interface net.rim.device.api.system.PersistentContentListener
PERSISTENT_CONTENT_LOCKED_INSECURE, PERSISTENT_CONTENT_LOCKED_SECURE, PERSISTENT_CONTENT_LOCKING, PERSISTENT_CONTENT_UNLOCKED
 
Constructor Summary
Category: Signed ContentProtectedVector()
          Creates a new ContentProtectedVector instance automatically protecting its contents.
Category: Signed ContentProtectedVector(boolean protect)
          Creates a new ContentProtectedVector instance.
Category: Signed ContentProtectedVector(int initialCapacity)
          Creates a new ContentProtectedVector instance of specified capacity, automatically protecting its contents.
Category: Signed ContentProtectedVector(int initialCapacity, int capacityIncrement)
          Creates a new ContentProtectedVector instance with specified capacity and capacity increment, automatically protecting its contents.
Category: Signed ContentProtectedVector(int initialCapacity, int capacityIncrement, boolean protect)
          Creates a new ContentProtectedVector instance with specified capacity and capacity incrememt.
 
Method Summary
Category: Signed  void addElement(Object obj)
          Adds provided element to the end of this vector.
Category: Signed  boolean checkCrypt()
          Determines if this vector's contents are protected properly.
Category: Signed  void copyInto(Object[] anArray)
          Copies this vector's components into the provided array.
Category: Signed  Object elementAt(int index)
          Retrieves element at provided index.
Category: Signed  Enumeration elements()
          Retrieves an enumeration of this vector's components.
Category: Signed  Object firstElement()
          Retrieves first element in this vector.
Category: Signed  int indexOf(Object elem, int index)
          Retrieves first matching element after provided index position.
Category: Signed  void insertElementAt(Object obj, int index)
          Inserts provided element at provided index.
Category: Signed  boolean isProtected()
          Determines if this vector's contents are currently protected.
Category: Signed  Object lastElement()
          Retrieves last element in this vector.
Category: Signed  int lastIndexOf(Object elem, int index)
          Retrieves first matching element before provided index position.
Category: Signed  void persistentContentModeChanged(int generation)
          Invoked when the persistent content mode changes.
Category: Signed  void persistentContentStateChanged(int state)
          Does nothing in this implementation.
Category: Signed  void reCrypt()
          Enables protection and encodes this vector's elements according to the user's content protection settings.
Category: Signed  void setElementAt(Object obj, int index)
          Places provided element at provided index.
 
Methods inherited from class java.util.Vector
capacity, contains, ensureCapacity, indexOf, isEmpty, lastIndexOf, removeAllElements, removeElement, removeElementAt, setSize, size, toString, trimToSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

ContentProtectedVector

public ContentProtectedVector(int initialCapacity,
                              int capacityIncrement,
                              boolean protect)
Creates a new ContentProtectedVector instance with specified capacity and capacity incrememt.

Parameters:
initialCapacity - Initial capacity for this vector.
capacityIncrement - Amount by which this vector's capacity gets increased when it overflows.
protect - If true, automatically encrypt content; if false, content only encrypted when the ContentProtectedVector.reCrypt() call deems it necessary.
Throws:
IllegalArgumentException - If the specified initial capacity is negative.
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 4.0.0

ContentProtectedVector

public ContentProtectedVector(int initialCapacity,
                              int capacityIncrement)
Creates a new ContentProtectedVector instance with specified capacity and capacity increment, automatically protecting its contents.

This constructor automatically invokes ContentProtectedVector.reCrypt() after creation.

Parameters:
initialCapacity - Initial capacity for this vector.
capacityIncrement - Amount by which this vector's capacity gets increased when it overflows.
Throws:
IllegalArgumentException - If the specified initial capacity is negative.
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 4.0.0

ContentProtectedVector

public ContentProtectedVector(int initialCapacity)
Creates a new ContentProtectedVector instance of specified capacity, automatically protecting its contents.

This constructor automatically invokes ContentProtectedVector.reCrypt() after creation.

Parameters:
initialCapacity - Initial capacity for this vector.
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 4.0.0

ContentProtectedVector

public ContentProtectedVector(boolean protect)
Creates a new ContentProtectedVector instance.

Parameters:
protect - If true, automatically encrypt content; if false, content only encrypted when the ContentProtectedVector.reCrypt() call deems it necessary.
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 4.0.0

ContentProtectedVector

public ContentProtectedVector()
Creates a new ContentProtectedVector instance automatically protecting its contents.

This convenience constructor simply wraps ContentProtectedVector(true).

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 4.0.0


Method Detail

copyInto

public void copyInto(Object[] anArray)
Copies this vector's components into the provided array.

If this vector's contents are already protected, this method decrypts them and stores them unencrypted into your array.

Overrides:
copyInto in class Vector
Parameters:
anArray - Array to contain this vector's components; the array must be large enough to hold all this vector's components.
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 4.0.0

elements

public Enumeration elements()
Retrieves an enumeration of this vector's components.

If this vector's contents are already protected, this method returns an enumeration containing the contents still encrypted.

Overrides:
elements in class Vector
Returns:
Enumeration of this vector's components.
See Also:
Enumeration
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 4.0.0

indexOf

public int indexOf(Object elem,
                   int index)
Retrieves first matching element after provided index position.

This method searches forwards from your provided index, and retrieves the first matching element it finds. Matching is done with the equals method.

Overrides:
indexOf in class Vector
Parameters:
elem - Object to match against.
index - First element in the vector to compare with provided object.
Returns:
Index of first matching element found, or -1 if no matching element found.
See Also:
Object.equals(java.lang.Object)
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 4.0.0

lastIndexOf

public int lastIndexOf(Object elem,
                       int index)
Retrieves first matching element before provided index position.

This method searches backwards from your provided index, and retrieves the first matching element it finds. Matching is done with the equals method.

Overrides:
lastIndexOf in class Vector
Parameters:
elem - Object to match against.
index - First element in the vector to compare with provided object.
Returns:
Index of the first matching element found, or -1 if no matching element found.
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 4.0.0

elementAt

public Object elementAt(int index)
Retrieves element at provided index.

Overrides:
elementAt in class Vector
Parameters:
index - Index of element to retrieve.
Returns:
Decoded object at provided index.
Throws:
ArrayIndexOutOfBoundsException - If provided index is invalid.
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 4.0.0

firstElement

public Object firstElement()
Retrieves first element in this vector.

Overrides:
firstElement in class Vector
Returns:
Decoded object in this vector's first position.
Throws:
NoSuchElementException - If this vector has no components.
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 4.0.0

lastElement

public Object lastElement()
Retrieves last element in this vector.

Overrides:
lastElement in class Vector
Returns:
Decoded object in this vector's last position.
Throws:
NoSuchElementException - If this vector has not components.
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 4.0.0

setElementAt

public void setElementAt(Object obj,
                         int index)
Places provided element at provided index.

This method discards any object currently stored at your provided index, replacing it with your provided object.

Overrides:
setElementAt in class Vector
Parameters:
obj - Object to copy into vector.
index - Position at which to place the object.
Throws:
ArrayIndexOutOfBoundsException - If your index is invalid.
See Also:
Vector.size()
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 4.0.0

insertElementAt

public void insertElementAt(Object obj,
                            int index)
Inserts provided element at provided index.

This method inserts your provided object at your provided index. Any objects currently at and after your provided index are shifted up one slot to accommodate the insertion.

Overrides:
insertElementAt in class Vector
Parameters:
obj - Object to insert.
index - Position your provided object should occupy after the insertion.
Throws:
ArrayIndexOutOfBoundsException - If your index is invalid.
See Also:
Vector.size()
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 4.0.0

addElement

public void addElement(Object obj)
Adds provided element to the end of this vector.

Overrides:
addElement in class Vector
Parameters:
obj - Element to add.
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 4.0.0

isProtected

public boolean isProtected()
Determines if this vector's contents are currently protected.

Returns:
True if this vector's contents are currently encrypted; otherwise, false.
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 4.0.0

checkCrypt

public boolean checkCrypt()
Determines if this vector's contents are protected properly.

This method uses PersistentContent.checkEncoding(Object) to verify the encoding of each element in this vector. If this vector is not yet protected, this method simply returns false without bothering to check any contained element.

Returns:
False if this vector is not currently protected, or if any element fails an encoding check; otherwise, true.
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 4.0.0

reCrypt

public void reCrypt()
Enables protection and encodes this vector's elements according to the user's content protection settings.

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 4.0.0

persistentContentModeChanged

public void persistentContentModeChanged(int generation)
Invoked when the persistent content mode changes.

If this vector is protected, this method invokes ContentProtectedVector.reCrypt() on the vector.

Specified by:
persistentContentModeChanged in interface PersistentContentListener
Parameters:
generation - Ignored in this implementation.
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 4.0.0

persistentContentStateChanged

public void persistentContentStateChanged(int state)
Does nothing in this implementation.

Specified by:
persistentContentStateChanged in interface PersistentContentListener
Parameters:
state - Ignored in this implementation.
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 4.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal