Skip to content

NDefMessage

com.rvi.domain.NDefMessage · Record · SocialCard 1.0.3

Validated raw NDEF bytes representing one or more records.

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.

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)); // true
System.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.

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.

NDefMessageCreator · NDefDecoder · TlvEncoder · NDefMessageException

Method signatures in the Javadoc · All API types