|
|||||||||
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.NDEFRecord
net.rim.device.api.io.nfc.ndef.rtd.TextRecord
public class TextRecord
Helps build and parse NFC Forum Text NDEF records.
Field Summary | ||
---|---|---|
static String |
TEXT_RECORD_TYPE
The NFC Forum record type name for text 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 | ||
---|---|---|
TextRecord()
Creates an empty text record. |
||
TextRecord(String text)
Creates a text record with the specified text parameter. |
||
TextRecord(String text,
String languageCode)
Creates a text record with the specified text parameter for the specified language code. |
||
TextRecord(NDEFRecord ndefRecord)
Creates a text record by extracting text record data from an existing NDEFRecord object. |
Method Summary | ||
---|---|---|
NDEFRecord |
clone()
Returns an NDEFRecord object that is a clone of this text record. |
|
String |
getLanguageCode()
Returns the language code for the text in this text record. |
|
byte[] |
getPayload()
Returns the payload for this Text NDEFRecord as a byte[] . |
|
String |
getText()
Returns the text for this text record. |
|
String |
getTextEncoding()
Returns the text encoding scheme for this tag. |
|
void |
setLanguageCode(String languageCode)
Sets the language code for the text in this text record. |
|
void |
setPayload(byte[] payload)
This method is not supported because the payload is generated. |
|
void |
setText(String text)
Sets the text for this text record. |
|
void |
setTextEncoding(String encoding)
Sets the text encoding scheme for this tag. |
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 |
---|
public static final String TEXT_RECORD_TYPE
Constructor Detail |
---|
public TextRecord() throws NFCException
NFCException
- If the TextRecord
cannot be constructed.public TextRecord(String text) throws NFCException
text
- The text to include in the TextRecord
.
NFCException
- If the TextRecord
cannot be constructed.public TextRecord(String text, String languageCode) throws NFCException
text
- The text to include in the text record.languageCode
- The language code of the text for the text record.
NFCException
- If the TextRecord
cannot be constructed.public TextRecord(NDEFRecord ndefRecord) throws NFCException
NDEFRecord
object.
ndefRecord
- NDEFRecord
to extract data from.
NFCException
- If the TextRecord
cannot be constructed.Method Detail |
---|
public String getText()
public void setText(String text)
text
- The text for this text record.
IllegalArgumentException
- If the text parameter is null
.public String getLanguageCode()
The
- language code for the text in this text record.public void setLanguageCode(String languageCode)
languageCode
- The languageCode for the text in this text record.
IllegalArgumentException
- If the languageCode is null
or too long.public String getTextEncoding()
public void setTextEncoding(String encoding)
"UTF-8"
"UTF-16BE"
encoding
- The text encoding scheme for this tag.
IllegalArgumentException
- If the text encoding is not one of the supported values.public byte[] getPayload()
NDEFRecord
as a byte[]
.
Note that the payload is generated each time this method is called.
getPayload
in class NDEFRecord
byte[]
representation of the payload for the text record.public void setPayload(byte[] payload)
setPayload
in class NDEFRecord
payload
- This parameter is not used.public NDEFRecord clone()
NDEFRecord
object that is a clone of this text record.
clone
in class NDEFRecord
NDEFRecord
that is a clone of this text record.
|
|||||||||
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