TlvEncoder
com.rvi.application.TlvEncoder · Class · SocialCard 1.0.3
Wrap an NDEF message as a Type 2 Tag TLV byte sequence.
When to use it
Section titled “When to use it”Call encode(message) to measure the payload plus its tag-memory overhead, or to prepare an image for an integration that expects a TLV. Write through IReaderService when using SocialCard’s reader connection.
Java example
Section titled “Java example”final NDefMessage message = new NDefEncoder().encodeURI("https://rithush.dev");final byte[] tlv = new TlvEncoder().encode(message);
System.out.printf("%d NDEF bytes, %d TLV bytes%n", message.data().length, tlv.length);Java imports
import com.rvi.application.NDefEncoder;import com.rvi.application.TlvEncoder;import com.rvi.domain.NDefMessage;A size estimate is possible offline. The repository checks the connected tag’s capacity before writing.
How it works
Section titled “How it works”The byte sequence starts with 0x03, uses a one-byte length below 255 bytes and an extended length for larger messages, and ends with 0xFE. ReaderRepository also accounts for page padding when it checks actual tag capacity.
Related API
Section titled “Related API”TlvDecoder · NDefMessage · ReaderRepository · CardCapacityException