SHOW Signed

net.rim.device.api.system
Class PersistentContent

java.lang.Object
  |
  +--net.rim.device.api.system.PersistentContent

public final class PersistentContent
extends Object

Allows a developer to compress and encrypt Strings and byte arrays.

This API was designed to allow applications to protect data in a database if the user has enabled Content Protection on their device.

To encode an object:

    String data = "This is a secret.";
    // first compress and encrypt data
    Object encoding = PersistentContent.encode( data, true, true );
    ... // then persist encoding
 

To decode an object:

   
    try {
        ...
        data = PersistentContent.decodeString( encoding );
        ...
    } catch( IllegalStateException e ) {
        // unable to decode data; the device must be locked.
    }     
 
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

Since:
JDE 4.0.0
See Also:
PersistentStore, PersistentObject, RecordStore

Method Summary
 Category: Signed static void addListener(PersistentContentListener listener)
          Adds a persistent content listener.
 Category: Signed static void addWeakListener(PersistentContentListener listener)
          Adds a weak persistent content listener.
 Category: Signed static boolean checkEncoding(Object encoding)
          Determines if provided encoding is protected under user's settings.
 Category: Signed static boolean checkEncoding(Object encoding, boolean compress, boolean encrypt)
          Determines if provided encoding is protected under provided settings.
 Category: Signed static Object convertByteArrayToEncoding(byte[] array)
          Converts a byte array to an encoding.
 Category: Signed static byte[] convertEncodingToByteArray(Object encoding)
          Converts a PersistentContent encoding of an object to a byte array.
 Category: Signed static Object copyEncoding(Object encoding)
          Retrieves a copy of the encoding.
 Category: Signed static Object decode(Object content)
          Decodes data.
 Category: Signed static Object decode(Object content, boolean firstBlockOnly)
          Decodes portion of data object.
 Category: Signed static byte[] decodeByteArray(Object content)
          Decodes byte array.
 Category: Signed static byte[] decodeByteArray(Object content, boolean firstBlockOnly)
          Decodes portion of byte array.
 Category: Signed static String decodeString(Object content)
          Decodes a string.
 Category: Signed static String decodeString(Object content, boolean firstBlockOnly)
          Decodes portion of string.
 Category: Signed static Object encode(byte[] data)
          Encrypts and compresses a byte array.
 Category: Signed static Object encode(byte[] data, boolean compress, boolean encrypt)
          Encrypts and/or compresses a byte array.
 Category: Signed static Object encode(byte[] data, int offset, int length, boolean compress, boolean encrypt)
          Encrypts and/or compresses a portion of a byte array.
 Category: Signed static Object encode(String string)
          Encrypts and/or compresses a string.
 Category: Signed static Object encode(String string, boolean compress, boolean encrypt)
          Encrypts and/or compresses a string.
 Category: Signed static Object encode(String string, int index, int length, boolean compress, boolean encrypt)
          Encrypts and/or compresses a sub-string.
 Category: Signed static Object encodeAndAppend(byte[] data, boolean compress, boolean encrypt, Object content)
          Encrypts and/or compresses a byte array and appends it to provided content.
 Category: Signed static Object encodeAndAppend(byte[] data, int offset, int length, boolean compress, boolean encrypt, Object content)
          Encrypts and/or compresses portion of a byte array and appends it to provided content.
 Category: Signed static Object encodeAndAppend(byte[] data, Object content)
          Encrypts and compresses a byte array and appends it to provided content.
 Category: Signed static Object encodeAndAppend(String string, boolean compress, boolean encrypt, Object content)
          Encrypts and/or compresses string and appends to provided content.
 Category: Signed static Object encodeAndAppend(String string, int index, int length, boolean compress, boolean encrypt, Object content)
          Encrypts and/or compresses a sub-string.
 Category: Signed static Object encodeAndAppend(String string, Object content)
          Encodes and compresses a string and appends to provided content.
 Category: Signed static Object encodeObject(Object obj)
          Encrypts and/or compresses an arbitrary object.
 Category: Signed static Object encodeObject(Object obj, boolean compress, boolean encrypt)
          Encrypts and compresses an arbitrary object.
 Category: Signed static int getLength(Object encoding)
          Retrieves the length of the decoded encoding.
 Category: Signed static int getLockGeneration()
          Retrieves a counter that changes every time the user locks or unlocks their device.
 Category: Signed static int getModeGeneration()
          Retrieves a counter that changes every time the user has changed their Content Protection settings.
 Category: Signed static int getState()
          Retrieves the state of the device.
 Category: Signed static Object getTicket()
          Retrieves decryption ticket.
 Category: Signed static boolean isByteArray(Object encoding)
          Determines if the encoding represents a byte array.
 Category: Signed static boolean isCompressionEnabled()
          Determines if Content Compression is enabled by the user.
 Category: Signed static boolean isContentProtectionSupported()
          Determines whether or not Content Protection is supported by this device.
 Category: Signed static boolean isEncryptionEnabled()
          Determines if Content Encryption is enabled by the user.
 Category: Signed static boolean isSecure()
          Determines whether or not the device is secure.
 Category: Signed static boolean isString(Object encoding)
          Determines if the encoding represents a String.
 Category: Signed static boolean isTicketInUse()
          Determines whether or not a ticket is still in use.
 Category: Signed static void markAsPlaintext(Object object)
           
 Category: Signed static Object reEncode(Object encoding)
          Re-encodes an object according to the user's current Content Protection setting.
 Category: Signed static Object reEncode(Object encoding, boolean compress, boolean encrypt)
          Re-encodes an object according to provided Content Protection setting.
 Category: Signed static void removeListener(PersistentContentListener listener)
          Removes a persistent content listener.
 Category: Signed static void requestReEncode()
          Request that all registered PersistentContentListeners re-encode their data.
 Category: Signed static Object waitForTicket()
          Blocks and waits to retrieve a decryption ticket.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSecure

public static boolean isSecure()
Determines whether or not the device is secure.
Returns:
True if the device supports content encryption and is secure; otherwise, false.
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isTicketInUse

public static boolean isTicketInUse()
Determines whether or not a ticket is still in use. If a ticket remains strongly referenced, the device will not be secure.
Returns:
True if a ticket is still referenced; otherwise, false.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isContentProtectionSupported

public static boolean isContentProtectionSupported()
Determines whether or not Content Protection is supported by this device.
Returns:
True if content protection is supported; otherwise, false.
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isEncryptionEnabled

public static boolean isEncryptionEnabled()
Determines if Content Encryption is enabled by the user.
Returns:
True if content encryption is currently enabled; otherwise, false.
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isCompressionEnabled

public static boolean isCompressionEnabled()
Determines if Content Compression is enabled by the user.
Returns:
True if content compression is currently enabled; otherwise, false.
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getModeGeneration

public static int getModeGeneration()
Retrieves a counter that changes every time the user has changed their Content Protection settings.

The value returned by this method should be considered for comparison purposes only. That is, comparing the return value to a previously returned value lets the caller know whether the Content Protection settings have changed since the previous call. If the values are different, then the Content Protection settings have changed.

Returns:
A counter that can be compared to previously returned values that will indicate if the Content Protection settings have changed since the last call.
Since:
JDE 4.0.0
See Also:
PersistentContentListener.persistentContentModeChanged(int)
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getLockGeneration

public static int getLockGeneration()
Retrieves a counter that changes every time the user locks or unlocks their device.

The value returned by this method should be considered for comparison purposes only. That is, comparing the return value to a previously returned value lets the caller know whether the device has locked or unlocked since the previous call. If the values are different, then the device has locked and/or unlocked.

Returns:
A counter that can be compared to previously returned values that will indicate if the device has locked or unlocked since the last call.
Since:
JDE 4.0.0
See Also:
PersistentContentListener.persistentContentStateChanged(int)
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getState

public static int getState()
Retrieves the state of the device.
Returns:
Value expressing the device's state.
Since:
JDE 4.0.0
See Also:
PersistentContentListener
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

addListener

public static void addListener(PersistentContentListener listener)
Adds a persistent content listener.
Parameters:
listener - Listener to add.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

addWeakListener

public static void addWeakListener(PersistentContentListener listener)
Adds a weak persistent content listener.
Parameters:
listener - The listener to add.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

removeListener

public static void removeListener(PersistentContentListener listener)
Removes a persistent content listener.
Parameters:
listener - Listener to remove.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

requestReEncode

public static void requestReEncode()
Request that all registered PersistentContentListeners re-encode their data. This function should be called if the app wants to enable or disable the use of encryption on a field, eg the user may have changed an option that requires some data to be availble while the device is locked (hence the encryption must be disabled for this field).
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

markAsPlaintext

public static void markAsPlaintext(Object object)
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

copyEncoding

public static Object copyEncoding(Object encoding)
Retrieves a copy of the encoding.

Parameters:
encoding - Encoding of the specified object.
Returns:
Copy of the encoding object.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getTicket

public static Object getTicket()
Retrieves decryption ticket.

If the device is currently unlocked, use this method to retrieve a ticket the caller can use to decrypt protected data, for as long as the ticket is strongly referenced. This allows the calling process to gain access to protected data during potentially long operations, such as sorting.

Note: please release all references to the returned ticket as soon as possible.

Returns:
Ticket object, or null, if the device is locked.
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

waitForTicket

public static Object waitForTicket()
Blocks and waits to retrieve a decryption ticket.

This method behaves like getTicket(), except that, if the device is locked, it waits for the device to unlock and then returns the ticket.

Returns:
Ticket object.
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeObject

public static Object encodeObject(Object obj)
Encrypts and/or compresses an arbitrary object. Note that only Strings and byte arrays are actually encoded.

Parameters:
obj - Object to encode and compress.
Returns:
Encoded and commpressed object.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeObject

public static Object encodeObject(Object obj,
                                  boolean compress,
                                  boolean encrypt)
Encrypts and compresses an arbitrary object. Note that only Strings and byte arrays are actually encoded.

Parameters:
string - String to encode and/or compress.
compress - If true, this method compresses string; otherwise, no compression performed.
encrypt - If true, this method encodes string; otherwise, no cyphering performed.
Returns:
Encoded/compressed string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encode

public static Object encode(String string)
Encrypts and/or compresses a string.

Parameters:
string - String to encode and compress.
Returns:
Encoded and commpressed string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encode

public static Object encode(String string,
                            boolean compress,
                            boolean encrypt)
Encrypts and/or compresses a string.

Parameters:
string - String to encode and/or compress.
compress - If true, this method compresses string; otherwise, no compression performed.
encrypt - If true, this method encodes string; otherwise, no cyphering performed.
Returns:
Encoded/compressed string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encode

public static Object encode(String string,
                            int index,
                            int length,
                            boolean compress,
                            boolean encrypt)
Encrypts and/or compresses a sub-string.

Parameters:
string - String to provide source of sub-string to encode and/or compress.
index - First character in string to encode/compress.
length - Number of characters from string to encode/compress.
compress - If true, this method compresses string; otherwise, no compression performed.
encrypt - If true, this method encodes string; otherwise, no cyphering performed.
Returns:
Encoded/compressed sub-string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeAndAppend

public static Object encodeAndAppend(String string,
                                     Object content)
Encodes and compresses a string and appends to provided content.
Parameters:
string - String to encode and compress.
content - Content object to which to append encoded and compressed string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeAndAppend

public static Object encodeAndAppend(String string,
                                     boolean compress,
                                     boolean encrypt,
                                     Object content)
Encrypts and/or compresses string and appends to provided content.
Parameters:
string - String to encode and/or compress.
compress - If true, this method compresses string; otherwise, no compression performed.
encrypt - If true, this method encodes string; otherwise, no cyphering performed.
content - Content object to which to append encoded/compressed string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeAndAppend

public static Object encodeAndAppend(String string,
                                     int index,
                                     int length,
                                     boolean compress,
                                     boolean encrypt,
                                     Object content)
Encrypts and/or compresses a sub-string.
Parameters:
string - String to provide source of sub-string to encode and/or compress.
index - First character in string to encode/compress.
length - Number of characters from string encode/compress.
compress - If true, this method compresses string; otherwise, no compression performed.
encrypt - If true, this method encodes string; otherwise, no cyphering performed.
content - Content object to which to append encoded/compressed string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encode

public static Object encode(byte[] data)
Encrypts and compresses a byte array.

Parameters:
data - Data to encode and compress.
Returns:
Encoded and compressed data.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encode

public static Object encode(byte[] data,
                            boolean compress,
                            boolean encrypt)
Encrypts and/or compresses a byte array.

Parameters:
data - Data to encode/compress.
compress - If true, this method compresses data; otherwise, no compression performed.
encrypt - If true, this method encodes data; otheriwse, no cyphering performed.
Returns:
Encoded/compressed data.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encode

public static Object encode(byte[] data,
                            int offset,
                            int length,
                            boolean compress,
                            boolean encrypt)
Encrypts and/or compresses a portion of a byte array.

Parameters:
data - Data to encode/compress.
offset - First byte in data to encode/compress.
length - Number of bytes from data to encode/compress.
compress - If true, this method compresses data; otherwise, no compression performed.
encrypt - If true, this method encodes data; otherwise, no cyphering performed.
Returns:
Encoded/compressed string.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeAndAppend

public static Object encodeAndAppend(byte[] data,
                                     Object content)
Encrypts and compresses a byte array and appends it to provided content.

Parameters:
data - Data to encode and compress.
content - Content object to which to append encoded and compressed data.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeAndAppend

public static Object encodeAndAppend(byte[] data,
                                     boolean compress,
                                     boolean encrypt,
                                     Object content)
Encrypts and/or compresses a byte array and appends it to provided content.

Parameters:
data - Data to encode/compress.
compress - If true, this method compresses string; otherwise, no compression performed.
encrypt - If true, this method encrypts string; otherwise, no cyphering performed.
content - Content object to which to append encoded/compressed data.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

encodeAndAppend

public static Object encodeAndAppend(byte[] data,
                                     int offset,
                                     int length,
                                     boolean compress,
                                     boolean encrypt,
                                     Object content)
Encrypts and/or compresses portion of a byte array and appends it to provided content.

Parameters:
data - Data to encode/compress.
offset - First byte in data to encode/compress.
length - Number of bytes from data to encode/compress.
compress - If true, this method compresses data; otherwise, no compression performed.
encrypt - If true, this method encrypts data; otherwise, no cyphering performed.
content - Content object to which to append encoded/compressed data.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

decode

public static Object decode(Object content)
Decodes data.

Parameters:
content - Data object to decode.
Returns:
Decoded data.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

decodeString

public static String decodeString(Object content)
Decodes a string.

Parameters:
content - Data object to decode.
Returns:
Decoded string.
Throws:
ClassCastException - thrown if the decoded object is not a String.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

decodeString

public static String decodeString(Object content,
                                  boolean firstBlockOnly)
Decodes portion of string.

Parameters:
content - Data object to decode.
firstBlockOnly - If true, decode only first block of data; otherwise, decode entire data object.
Returns:
Decoded string, or first block of string.
Throws:
ClassCastException - thrown if the decoded object is not a String.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

decodeByteArray

public static byte[] decodeByteArray(Object content)
Decodes byte array.

Parameters:
content - Data object to decode.
Returns:
Decoded byte array.
Throws:
ClassCastException - thrown if the decoded object is not a byte array.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

decodeByteArray

public static byte[] decodeByteArray(Object content,
                                     boolean firstBlockOnly)
Decodes portion of byte array.

Parameters:
content - Data object to decode.
firstBlockOnly - If true, decode only first block of data; otherwise, decode entire data object.
Returns:
Decoded byte array, or first block of array.
Throws:
ClassCastException - thrown if the decoded object is not a byte array.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

decode

public static Object decode(Object content,
                            boolean firstBlockOnly)
Decodes portion of data object.

Parameters:
content - Data object to decode.
firstBlockOnly - If true, decode only first block of data; otherwise, decode entire data object.
Returns:
Decoded data object, or first block of object.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isString

public static boolean isString(Object encoding)
Determines if the encoding represents a String.

Parameters:
encoding - Encoding to test.
Returns:
True if encoding represents a string; otherwise, false.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

isByteArray

public static boolean isByteArray(Object encoding)
Determines if the encoding represents a byte array.

Parameters:
encoding - Encoding to test.
Returns:
True if encoding represents a byte array; otherwise, false.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getLength

public static int getLength(Object encoding)
Retrieves the length of the decoded encoding.

If the encoding represents a string, then this method returns String.length(). If the encoding represents a byte array, then this method returns the number of byte elements in the array.

Parameters:
encoding - Encoding to measure.
Returns:
Length of the encoding.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

checkEncoding

public static boolean checkEncoding(Object encoding)
Determines if provided encoding is protected under user's settings.

Use this method to determine if the provided encoding is protected according to the user's settings.

Parameters:
encoding - Encoding to check.
Returns:
True if the data is protected and OK; otherwise, the data should be rencoded with reEncode(java.lang.Object).
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

checkEncoding

public static boolean checkEncoding(Object encoding,
                                    boolean compress,
                                    boolean encrypt)
Determines if provided encoding is protected under provided settings.

Use this method to determine if the provided encoding is protected according to the provided settings and the user's setting.

checkEncoding() will return true iff all the following consitions are true:

  • The user has disabled content protection or encrypt is false, and the data is not encrypted.
  • The user has disabled content compression or compress is false, and the data is not compressed.
Parameters:
encoding - Encoding to check.
compress - Compression setting to use.
encrypt - Encryption setting to use.
Returns:
True if the data is protected and OK; otherwise, the data should be rencoded with reEncode(java.lang.Object).
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

reEncode

public static Object reEncode(Object encoding)
Re-encodes an object according to the user's current Content Protection setting.

This method encrypts or decrypts the current encoding as required, and returns the results.

Parameters:
encoding - Encoding to re-encode.
Returns:
Re-encoded object.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

reEncode

public static Object reEncode(Object encoding,
                              boolean compress,
                              boolean encrypt)
Re-encodes an object according to provided Content Protection setting.

This method encrypts or decrypts the current encoding as required, and returns the result.

Parameters:
encoding - Encoding to re-encode.
compress - Compression setting to use.
encrypt - Encryption setting to use.
Returns:
Re-encoded object.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

convertEncodingToByteArray

public static byte[] convertEncodingToByteArray(Object encoding)
Converts a PersistentContent encoding of an object to a byte array.
Parameters:
encoding - Encoding to convert
Returns:
Byte array that contains the encoding.
Since:
JDE 4.0.2
See Also:
convertByteArrayToEncoding(byte[])
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

convertByteArrayToEncoding

public static Object convertByteArrayToEncoding(byte[] array)
Converts a byte array to an encoding.
Parameters:
array - Byte array that contains the encoding, as returned by convertEncodingToByteArray(java.lang.Object).
Returns:
An encoding that can be passed to decode(java.lang.Object).
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.


Copyright 1999-2004 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.