|
|||||||||
| 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.NDEFMessage
public class NDEFMessage
Represents an NDEF message as specified by the NFC Forum. Acts as a container for NDEF records. Provides methods to set and retrieve NDEF records as well as a byte-representation of the NDEF message.
| Constructor Summary | ||
|---|---|---|
NDEFMessage()
Constructs an empty NDEF message. |
||
NDEFMessage(byte[] payload)
Constructs an NDEF message from a byte array. |
||
| Method Summary | ||
|---|---|---|
void |
appendRecord(NDEFRecord record)
Appends an NDEF record to the message. |
|
void |
appendRecords(NDEFRecord[] records)
Append a set of NDEF records to the message. |
|
NDEFMessage |
clone()
Clones this NDEF message. |
|
byte[] |
getBytes()
Returns the byte-representation of this NDEF message. |
|
int |
getNumberOfRecords()
Returns the number of NDEF records in the message. |
|
NDEFRecord[] |
getRecords()
Returns all NDEF records in the message. |
|
void |
setRecords(NDEFRecord[] records)
Populates this NDEF message with a set of NDEF records. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NDEFMessage()
public NDEFMessage(byte[] payload)
throws BadFormatException,
NFCException
payload - The byte-representation of this NDEF message.
BadFormatException - When an NDEF message cannot be created
because the payload is not well formed.
IllegalArgumentException - If the message bytes parameter
is greater than 40K in size.
NFCException - When an NDEF message cannot be created for
any other reason.| Method Detail |
|---|
public int getNumberOfRecords()
public NDEFRecord[] getRecords()
NDEFRecord objects.public void setRecords(NDEFRecord[] records)
records - An array of NDEFRecord objects to set in the message.
IllegalArgumentException - If the byte representation of the
message will be greater than 40K in size.public void appendRecord(NDEFRecord record)
record - The NDEFRecord to append.
IllegalArgumentException - If the byte representation of the
message will be greater than 40K in size.public void appendRecords(NDEFRecord[] records)
records - An array of NDEFRecord objects to append.
IllegalArgumentException - If the byte representation of the
message will be greater than 40K in size.
public byte[] getBytes()
throws NFCException
byte array that represents this NDEF message.
NFCException - If the byte[] representation of the NDEFMessage cannot be returned.public NDEFMessage clone()
NDEFMessage.
|
|||||||||
| 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