SHOW Signed
 

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

java.lang.Object
  |
  +--net.rim.device.api.crypto.transcoder.Transcoder

public abstract class Transcoder
extends Object

This interface defines the methods required to encode and decode data sent to and from the device. In order to encode or decode any messages, a Transcoder must first register with the TranscoderManager using TranscoderManager#registerTranscoder.

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:
JDE 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_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 object will never be null.

Type: String

Since:
JDE 4.5.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.

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 object will never be null.

When a message is sent from the device, this array may 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.

When a message is sent to the device, this array may contain 0 or 1 item(s). There will be 1 item if and only if the transmission contains a bounded service record.

Type: String[]

Since:
JDE 4.5.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.
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.
Since:
JDE 4.5.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.
Method Detail

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.

If this Transcoder has registered with the TranscoderManager, messages sent to the device will be passed into this method for decoding. This method should check whether the message was encoded with a corresponding encoder before decoding the message.

Parameters:
input - the message to decode
output - the decoded message should be stored in this output stream
context - the context of the message; the list of keys used to obtain the context-sensitive information in this hashtable could be found at Transcoder (as the constants beginning with "CONTEXT_")
Returns:
true if encoding was successful, false otherwise.
Since:
JDE 4.5.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.

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.

If this Transcoder has registered with the TranscoderManager, messages sent from the device will be passed into this method for encoding. This method should check whether a corresponding decoder has been implemented on the receiver before encoding the message.

Parameters:
input - the message to encode
output - the encoded message should be stored in this output stream
context - the context of the message; the list of keys used to obtain the context-sensitive information in this hashtable could be found at Transcoder (as the constants beginning with "CONTEXT_")
Returns:
true if encoding was successful, false otherwise.
Since:
JDE 4.5.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.

getID

public final byte getID()
Returns a byte that uniquely identifies this transcoder
Returns:
byte identifier
Since:
JDE 4.5.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.

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.
Since:
JDE 4.5.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.



Copyright 1999-2008 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.