NDefMessage
com.rvi.domain.NDefMessage · Record · SocialCard 1.0.3
Validated raw NDEF bytes representing one or more records.
When to use it
Section titled “When to use it”Build a message with NDefMessageCreator or NDefEncoder. Use new NDefMessage(bytes) when you receive raw NDEF bytes from elsewhere. To inspect typed values, pass the message to NDefDecoder.
Java example
Section titled “Java example”final NDefMessage message = new NDefEncoder().encodeURI("https://rithush.dev");final byte[] exported = message.data();final NDefMessage restored = new NDefMessage(exported);
System.out.println(restored.equals(message)); // trueSystem.out.println(new TlvEncoder().encode(restored).length);Java imports
import com.rvi.application.NDefEncoder;import com.rvi.application.TlvEncoder;import com.rvi.domain.NDefMessage;Use the TLV-encoded length when estimating how much tag space the message needs.
How it works
Section titled “How it works”The constructor validates framing and supported record layouts, including record boundaries and payload lengths. data() returns a defensive copy and equality compares byte contents. Tag memory adds a TLV wrapper around these bytes, so data().length counts the message alone.
Related API
Section titled “Related API”NDefMessageCreator · NDefDecoder · TlvEncoder · NDefMessageException