net.rim.device.api.io.nfc.ndef.rtd
Class SmartPosterRecord

java.lang.Object
  extended by net.rim.device.api.io.nfc.ndef.NDEFRecord
      extended by net.rim.device.api.io.nfc.ndef.rtd.SmartPosterRecord

public class SmartPosterRecord
extends NDEFRecord

Helps build and parse NFC Forum smart poster NDEF records.

Since:
BlackBerry API 7.1.0

Field Summary
static int SMART_POSTER_ACTION_DEFAULT
          Indicates that an application should be opened to view the smart poster.
static int SMART_POSTER_ACTION_EDIT
          Indicates that the smart poster should be opened in edit mode.
static int SMART_POSTER_ACTION_SAVE
          Indicates that this smart poster should be saved for later viewing.
static String SMART_POSTER_RECORD_TYPE
          The NFC Forum record type name for smart poster records.
 
Fields inherited from class net.rim.device.api.io.nfc.ndef.NDEFRecord
TNF_ABSOLUTE_URI, TNF_ANY, TNF_EMPTY, TNF_EXTERNAL, TNF_MEDIA, TNF_UNCHANGED, TNF_UNKNOWN, TNF_WELL_KNOWN
 
Constructor Summary
SmartPosterRecord()
          Creates an empty smart poster.
SmartPosterRecord(String uri, String title, String languageCode)
          Creates a smart poster record using the specified URI, title, and language code.
SmartPosterRecord(NDEFRecord ndefRecord)
          Creates a smart poster record by extracting smart poster data from an existing NDEFRecord object.
 
Method Summary
 void addAdditionalRecord(NDEFRecord record)
          Adds an additional NDEFRecord object to the smart poster.
 void addTitle(String title, String languageCode)
          Adds a title for a specified language code.
 NDEFRecord clone()
          Returns an NDEFRecord object that is a clone of this smart poster.
 int getAction()
          Returns the action associated with the smart poster.
 Vector getAdditionalRecords()
          Returns the additional, user defined NDEFRecord objects included in this smart poster.
 byte[] getIconBytes()
          Returns a byte[] array of the icon image.
 String getIconType()
          Returns the MIME type of the icon image.
 String getMimeType()
          Returns the MIME type of the data referenced by the smart poster URI.
 byte[] getPayload()
          Returns the payload for this smart poster NDEFRecord as a byte[].
 int getSize()
          Returns the size of the data referenced by the smart poster URI.
 Hashtable getTitles()
          Returns a Hashtable that maps each supported language code to the title for that language code.
 String getUri()
          Returns the URI for this smart poster.
 void setAction(int action)
          Sets the action associated with the smart poster.
 void setAdditionalRecords(Vector records)
          Sets the additional, user defined NDEFRecord objects to be included in this smart poster.
 void setIconBytes(byte[] bytes)
          Sets the byte[] icon image.
 void setIconType(String type)
          Sets the MIME type of the icon image.
 void setMimeType(String type)
          Sets the MIME type of the data referenced by the smart poster URI.
 void setPayload(byte[] payload)
          This method is not supported because the payload is generated.
 void setSize(int size)
          Sets the size of the data referenced by the smart poster URI.
 void setUri(String uri)
          Sets the URI for this smart poster.
 
Methods inherited from class net.rim.device.api.io.nfc.ndef.NDEFRecord
getId, getType, getTypeNameFormat, isFirstRecord, isLastRecord, setId, setType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

SMART_POSTER_RECORD_TYPE

public static final String SMART_POSTER_RECORD_TYPE
The NFC Forum record type name for smart poster records.

See Also:
Constant Field Values
Since:
BlackBerry API 7.1.0

SMART_POSTER_ACTION_DEFAULT

public static final int SMART_POSTER_ACTION_DEFAULT
Indicates that an application should be opened to view the smart poster.

See Also:
Constant Field Values
Since:
BlackBerry API 7.1.0

SMART_POSTER_ACTION_SAVE

public static final int SMART_POSTER_ACTION_SAVE
Indicates that this smart poster should be saved for later viewing.

See Also:
Constant Field Values
Since:
BlackBerry API 7.1.0

SMART_POSTER_ACTION_EDIT

public static final int SMART_POSTER_ACTION_EDIT
Indicates that the smart poster should be opened in edit mode.

See Also:
Constant Field Values
Since:
BlackBerry API 7.1.0


Constructor Detail

SmartPosterRecord

public SmartPosterRecord()
                  throws NFCException
Creates an empty smart poster.

Throws:
NFCException - If the smart poster record cannot be constructed.
Since:
BlackBerry API 7.1.0

SmartPosterRecord

public SmartPosterRecord(String uri,
                         String title,
                         String languageCode)
                  throws NFCException
Creates a smart poster record using the specified URI, title, and language code.

Parameters:
uri - The URI for the smart poster.
title - The title of the smart poster.
languageCode - The language code associated with the title.
Throws:
NFCException - If the smart poster record cannot be constructed.
IllegalArgumentException - If the uri parameter is null.
Since:
BlackBerry API 7.1.0

SmartPosterRecord

public SmartPosterRecord(NDEFRecord ndefRecord)
                  throws NFCException
Creates a smart poster record by extracting smart poster data from an existing NDEFRecord object.

Parameters:
ndefRecord - An NDEF record that contains an NFC Forum smart poster.
Throws:
NFCException - If the smart poster record cannot be constructed.
IllegalArgumentException - If the ndefRecord parameter is null, or the ndefRecord parameter does not contain a smart poster.
Since:
BlackBerry API 7.1.0


Method Detail

getUri

public String getUri()
Returns the URI for this smart poster.

Returns:
The URI for this smart poster.
Since:
BlackBerry API 7.1.0

setUri

public void setUri(String uri)
Sets the URI for this smart poster.

Throws:
IllegalArgumentException - If the uri parameter is null.
Since:
BlackBerry API 7.1.0

getTitles

public Hashtable getTitles()
Returns a Hashtable that maps each supported language code to the title for that language code.

Returns:
Hashtable that maps each supported language code to the title for that language code.
Since:
BlackBerry API 7.1.0

addTitle

public void addTitle(String title,
                     String languageCode)
Adds a title for a specified language code.

Parameters:
title - The title to add.
languageCode - The language code of the title to be added. The language code should conform to RFC 3306.
Since:
BlackBerry API 7.1.0

getMimeType

public String getMimeType()
Returns the MIME type of the data referenced by the smart poster URI.

Returns:
The MIME type of the data referenced by the smart poster URI.
Since:
BlackBerry API 7.1.0

setMimeType

public void setMimeType(String type)
Sets the MIME type of the data referenced by the smart poster URI.

Parameters:
type - The MIME type of the data referenced by the smart poster URI.
Since:
BlackBerry API 7.1.0

getSize

public int getSize()
Returns the size of the data referenced by the smart poster URI.

Returns:
The size of the data referenced by the smart poster URI.
Since:
BlackBerry API 7.1.0

setSize

public void setSize(int size)
Sets the size of the data referenced by the smart poster URI.

Parameters:
size - The size of the data referenced by the smart poster URI.
Since:
BlackBerry API 7.1.0

getAction

public int getAction()
Returns the action associated with the smart poster. The action can be one of:

Returns:
The action associated with the smart poster.
Since:
BlackBerry API 7.1.0

setAction

public void setAction(int action)
Sets the action associated with the smart poster. The action should be one of:

Parameters:
action - The action associated with the smart poster.
Since:
BlackBerry API 7.1.0

getIconType

public String getIconType()
Returns the MIME type of the icon image.

Returns:
MIME type of the icon image.
Since:
BlackBerry API 7.1.0

setIconType

public void setIconType(String type)
Sets the MIME type of the icon image.

Parameters:
type - MIME type of the icon image.
Throws:
IllegalArgumentException - If the type is not a valid image or video MIME type.
Since:
BlackBerry API 7.1.0

getIconBytes

public byte[] getIconBytes()
Returns a byte[] array of the icon image.

Returns:
byte[] array of the icon image.
Since:
BlackBerry API 7.1.0

setIconBytes

public void setIconBytes(byte[] bytes)
Sets the byte[] icon image.

Parameters:
bytes - byte[] array of the icon image.
Since:
BlackBerry API 7.1.0

getAdditionalRecords

public Vector getAdditionalRecords()
Returns the additional, user defined NDEFRecord objects included in this smart poster.

Returns:
Vector of additional NDEFRecord objects included in the smart poster.
Since:
BlackBerry API 7.1.0

setAdditionalRecords

public void setAdditionalRecords(Vector records)
Sets the additional, user defined NDEFRecord objects to be included in this smart poster.

Parameters:
records - Vector of additional NDEFRecord objects to be included in the smart poster.
Since:
BlackBerry API 7.1.0

addAdditionalRecord

public void addAdditionalRecord(NDEFRecord record)
Adds an additional NDEFRecord object to the smart poster.

Parameters:
record - Additional NDEFRecord to add to the smart poster.
Since:
BlackBerry API 7.1.0

getPayload

public byte[] getPayload()
Returns the payload for this smart poster NDEFRecord as a byte[]. Note that the payload is generated each time this method is called.

Overrides:
getPayload in class NDEFRecord
Returns:
byte[] representation of the payload for the smart poster.
Since:
BlackBerry API 7.1.0

setPayload

public void setPayload(byte[] payload)
This method is not supported because the payload is generated.

Overrides:
setPayload in class NDEFRecord
Parameters:
payload - This parameter is not used.
Since:
BlackBerry API 7.1.0

clone

public NDEFRecord clone()
Returns an NDEFRecord object that is a clone of this smart poster.

Overrides:
clone in class NDEFRecord
Returns:
NDEFRecord that is a clone of this smart poster.
Since:
BlackBerry API 7.1.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