NDefMessageException
com.rvi.domain.exception.NDefMessageException · Class · SocialCard 1.0.3
Report invalid NDEF bytes or a payload the decoder cannot represent.
When to use it
Section titled “When to use it”Catch it when constructing a message from external bytes or interpreting data read from a tag. Keep the raw bytes for debugging if appropriate, and treat an unfamiliar payload as a format problem.
Java example
Section titled “Java example”try { new NDefMessage(new byte[] { (byte) 0xD1, 0x01 });} catch (final NDefMessageException failure) { System.err.println(failure.getMessage());}Java imports
import com.rvi.domain.NDefMessage;import com.rvi.domain.exception.NDefMessageException;This byte sequence contains a truncated record header. Use the encoder or message builder to produce well-formed bytes.
How it works
Section titled “How it works”NDefMessage checks the structure and supported record shapes at construction. NDefDecoder.decode() performs further validation when it parses values, such as vCard properties or Wi-Fi credential attributes. A message can pass the first check and fail the second.