Sequenceablepublic class MessageRecord extends Object implements Sequenceable
MessageRecord is the metadata of NdefMessage. An NdefMessage instance
consists of one or more MessageRecord.
Sequenceable.Producer<T>| 构造器 | 说明 |
|---|---|
MessageRecord(short tnf,
byte[] type,
byte[] id,
byte[] payload) |
Constructs an NDEF record with specified parameters.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static MessageRecord |
buildApplicationRecord(String packageName) |
Creates an NDEF record for an OHOS application.
|
static MessageRecord |
buildExternal(String domain,
String type,
byte[] data) |
Creates an NDEF record containing external data.
|
static MessageRecord |
buildMime(String mimeType,
byte[] mimeData) |
Creates an NDEF record containing MIME data.
|
static MessageRecord |
buildTextRecord(String languageCode,
String text) |
Creates an NDEF record containing text data.
|
Optional<Uri> |
buildUri() |
Builds a URI from this NDEF record.
|
boolean |
equals(Object obj) |
Check whethers two objects are equal.
|
byte[] |
getId() |
Obtains the ID of the NDEF record.
|
byte[] |
getPayload() |
Obtains the payload of the NDEF record.
|
short |
getTnf() |
Obtains the TNF of the NDEF record.
|
byte[] |
getType() |
Obtains the payload type of the NDEF record.
|
int |
hashCode() |
Gets the hash code of the object.
|
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
hasFileDescriptorpublic MessageRecord(short tnf,
byte[] type,
byte[] id,
byte[] payload)
tnf - Indicates the TNF of the NDEF record.type - Indicates the payload type of the NDEF record.id - Indicates the ID of the NDEF record, which is used for referencing between NDEF records.payload - Indicates the payload, which contains user data.public short getTnf()
public byte[] getType()
public byte[] getId()
public byte[] getPayload()
public int hashCode()
hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public boolean equals(Object obj)
equals 在类中 Objectobj - the reference object with which to compare.true if two objects are equal; returns false otherwise.Object.hashCode(),
HashMappublic static MessageRecord buildApplicationRecord(String packageName)
packageName - Indicates the package name of the application.IllegalArgumentException - if the package name is empty.public static MessageRecord buildMime(String mimeType, byte[] mimeData)
mimeType - Indicates the MIME type.mimeData - Indicates the MIME data.IllegalArgumentException - if the mimeType is empty or invalid.public static MessageRecord buildExternal(String domain, String type, byte[] data)
domain - Indicates the domain name of the data issuing organization.type - Indicates the data type.data - Indicates the external data.IllegalArgumentException - if either domain or type are empty or invalid.public static MessageRecord buildTextRecord(String languageCode, String text)
languageCode - Indicates the language code.text - Indicates the text.IllegalArgumentException - if the languageCode is empty or invalid.public Optional<Uri> buildUri()
public boolean marshalling(Parcel out)
SequenceableSequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be marshaled..true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
SequenceableSequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.