net.rim.device.api.crypto.transcoder
Class Transcoder

java.lang.Object
  extended by net.rim.device.api.crypto.transcoder.Transcoder

public abstract class Transcoder
extends Object

This abstract class defines the methods required to encode and decode data sent to and from the device. A Transcoder must register with the TranscoderManager using TranscoderManager.register(net.rim.device.api.crypto.transcoder.Transcoder) before it will be used to encode or decode any messages.

Once a transcoder has been registered, messages sent from the device will be passed into its encode(...) method for encoding. Similarly, messages sent to the device will be passed into its decode(...) method for decoding.

The transcoder is responsible for ensuring that a corresponding transcoder has been implemented on the receiver/sender before performing any transcoding. The transcoder will also be responsible for any and all key management required as part of the encoding scheme.

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.5.0

Field Summary
Category: Signed static int CONTEXT_GME_ADDRESS_STRING
          The hashtable key for retrieving the GME address string from the context.
Category: Signed static int CONTEXT_SERVICE_RECORD_UID
          The hashtable key for retrieving an array of service record UID string(s) from the context object.
 
Constructor Summary
Category: Signed Transcoder(byte id)
          Creates a transcoder instance.
 
Method Summary
Category: Signed abstract  boolean decode(InputStream input, OutputStream output, IntHashtable context)
          Decodes the data in the input stream and outputs the decoded data into the output stream.
Category: Signed abstract  boolean encode(InputStream input, OutputStream output, IntHashtable context)
          Encodes the data in the input stream and outputs the encoded data into the output stream.
Category: Signed  byte getID()
          Returns a byte that uniquely identifies this transcoder.
Category: Signed abstract  boolean willTranscode(IntHashtable context)
          Query the transcoder with a context to see if the transcoder will perform an operation in the supplied context.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

CONTEXT_SERVICE_RECORD_UID

public static final int CONTEXT_SERVICE_RECORD_UID

The hashtable key for retrieving an array of service record UID string(s) from the context object. The retrieved array will never be null.

In encode(...), the retrieved array will contain 0 or more items. Each item in this array will correspond to a service record in the service book. The service record(s) for the transmission may be retrieved using the UID string(s) in this array.

In decode(...), the retrieved array will contain 0 or 1 item(s). There will be exactly 1 item if and only if the transmission contains a bounded service record.

Type: String[]

See Also:
Constant Field Values
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.5.0

CONTEXT_GME_ADDRESS_STRING

public static final int CONTEXT_GME_ADDRESS_STRING

The hashtable key for retrieving the GME address string from the context. The string will be formatted according to:

[CID]([/UID[(REDIRECT)][:PIN[(REDIRECT)]])*[$SRC[(REDIRECT)]]

The retrieved string will never be null.

Type: String

See Also:
Constant Field Values
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.5.0


Constructor Detail

Transcoder

public Transcoder(byte id)
Creates a transcoder instance.

Parameters:
id - The unique ID of this transcoder instance. Cannot be zero.
Throws:
IllegalArgumentException - if ID equals 0.
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.5.0


Method Detail

getID

public final byte getID()
Returns a byte that uniquely identifies this transcoder.

Returns:
byte the unique transcoder ID
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.5.0

willTranscode

public abstract boolean willTranscode(IntHashtable context)
Query the transcoder with a context to see if the transcoder will perform an operation in the supplied context. Used to filter calls to encode and decode.

Parameters:
context - the context to be checked
Returns:
true if transcoding will be performed in the supplied context, false otherwise.
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.5.0

encode

public abstract boolean encode(InputStream input,
                               OutputStream output,
                               IntHashtable context)

Encodes the data in the input stream and outputs the encoded data into the output stream. Messages sent from the device will be passed into this method for encoding if this transcoder is registered.

Parameters:
input - the message to encode
output - the encoded message should be stored in this output stream
context - the context of the message
Returns:
true if encoding was successful, false otherwise.
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.5.0

decode

public abstract boolean decode(InputStream input,
                               OutputStream output,
                               IntHashtable context)

Decodes the data in the input stream and outputs the decoded data into the output stream. Messages sent to the device will be passed into this method for decoding if this transcoder is registered.

Parameters:
input - the message to decode
output - the decoded message should be stored in this output stream
context - the context of the message
Returns:
true if decoding was successful, false otherwise.
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.5.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