|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.io.nfc.ndef.NDEFMessageUtils
public class NDEFMessageUtils
Helps create different types of NDEF messages.
| Method Summary | ||
|---|---|---|
static NDEFMessage |
createExternalTypeMessage(String domainName,
String typeName,
byte[] content)
Creates an NDEF message with a single record, and specifies the type as NFC Forum External Type. |
|
static NDEFMessage |
createMediaTypeNDEFMessage(String mimeType,
byte[] content)
Creates an NDEF message with an NDEFRecord.TNF_MEDIA RTD record. |
|
static NDEFMessage |
createMediaTypeNDEFMessage(String mimeType,
String resourceUrl)
Creates an NDEF message with a single MIME media type record (NFC-Forum MIME media type NDEFRecord). |
|
static NDEFMessage |
createSmartPosterUriNDEFMessage(String uri,
String title,
String languageCode)
Creates an NDEF message with a single smart poster record (NFC-Forum smart poster NDEFRecord containing a URI record and an optional Title record). |
|
static NDEFMessage |
createTextNDEFMessage(String text,
String languageCode)
Creates an NDEF message with a single text record (NFC-Forum Text RTD NDEFRecord). |
|
static NDEFMessage |
createUriNDEFMessage(String uri)
Creates an NDEF message with a single URI record (NFC-Forum URI RTD NDEFRecord). |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static NDEFMessage createUriNDEFMessage(String uri)
throws NFCException
URI record (NFC-Forum URI RTD NDEFRecord).
The NDEF message could be used to store a URI in an NFC-compliant tag or to transport to other NFC devices.
uri - The URI to be set as the payload of the NDEFRecord.
NDEFMessage with a URI RTD NDEFRecord. The NDEFRecord has type name format NDEFRecord.TNF_WELL_KNOWN and record type "U".
NFCException - If the NDEF message cannot be created.
IllegalArgumentException - If the URI is null.
public static NDEFMessage createTextNDEFMessage(String text,
String languageCode)
throws NFCException
single text record (NFC-Forum Text RTD NDEFRecord).
text - The plain text to be set as the playload of the NDEFRecord.languageCode - The ISO/IANA language code.
NDEFMessage with a Text RTD NDEFRecord. The NDEFRecord has type name format NDEFRecord.TNF_WELL_KNOWN and record type "T".
NFCException - If the NDEF message cannot be created.
IllegalArgumentException - If languageCode is null or invalid, or text is null.
public static NDEFMessage createSmartPosterUriNDEFMessage(String uri,
String title,
String languageCode)
throws NFCException
smart poster record (NFC-Forum smart poster NDEFRecord containing a URI record and an optional Title record). For more information about smart posters, see http://www.nfc-forum.org/specs/spec_list/#rtds.
uri - The URI to be included in the Smart Poster NDEFRecord.title - The title of the URI. The title is optional.languageCode - The ISO/IANA language code for the title.
NDEFMessage with a smart poster NDEFRecord. The NDEFRecord has type name format NDEFRecord.TNF_WELL_KNOWN and record type "Sp".
NFCException - If the NDEF message cannot be created.
IllegalArgumentException - If the URI, title, or languageCode is null.
public static NDEFMessage createMediaTypeNDEFMessage(String mimeType,
String resourceUrl)
throws NFCException
NDEFRecord).
mimeType - MIME_TYPE of the resource.resourceUrl - URL of the resource.
NDEFMessage with a NFC-Forum MIME media type NDEFRecord. The NDEFRecord has type name format NDEFRecord.TNF_MEDIA and record type as the mimeType.
NFCException - If the NDEF message cannot be created.
IllegalArgumentException - If the MIME_TYPE or resource URL is invalid.
public static NDEFMessage createMediaTypeNDEFMessage(String mimeType,
byte[] content)
throws NFCException
NDEFRecord.TNF_MEDIA RTD record.
mimeType - MIME_TYPE of the resource.content - Binary content of the resource.
NDEFMessage with a NFC-Forum MIME media type NDEFRecord. The NDEFRecord has type name format NDEFRecord.TNF_MEDIA and record type as the mimeType.
NFCException - If the NDEF message cannot be created.
IllegalArgumentException - If the MIME_TYPE is invalid, or the resource content is empty.
public static NDEFMessage createExternalTypeMessage(String domainName,
String typeName,
byte[] content)
throws NFCException
domainName - The domain name of the organization responsible for managing the name space for the record type.typeName - An application-specific record type that is valid for the namespace defined by the domainName.content - Binary content of the application specific type.
NDEFMessage with a single NDEFRecord. The NDEFRecord has type name format NDEFRecord.TNF_EXTERNAL and record type is "NFCException - If the NDEF message cannot be created.
IllegalArgumentException - If the domain name or type name is invalid, or the content is empty.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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