CardCapacityException
com.rvi.application.exception.CardCapacityException · Class · SocialCard 1.0.3
Signals that the encoded write exceeds the available tag capacity.
When to use it
Section titled “When to use it”Catch this exception before ReaderServiceException when you can give a targeted recovery message. Reduce the content size and try again, or use a supported tag with adequate writable memory.
Java example
Section titled “Java example”static void writeWithCapacityFeedback(final IReaderService reader, final NDefMessage message) { try { reader.write(message); } catch (final CardCapacityException failure) { System.err.println(failure.getMessage()); System.err.println("Shorten the message and try again."); }}Java imports
import com.rvi.application.exception.CardCapacityException;import com.rvi.domain.NDefMessage;import com.rvi.service.IReaderService;The supplied reader must already be connected. Use TlvEncoder for an offline estimate.
How it works
Section titled “How it works”It extends ReaderServiceException. The repository compares the encoded size rounded to a four-byte page boundary with writable capacity before writing any pages. The constructor formats the required and available byte counts into the exception message.