Skip to content

CardCapacityException

com.rvi.application.exception.CardCapacityException · Class · SocialCard 1.0.3

Signals that the encoded write exceeds the available tag capacity.

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.

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.

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.

ReaderServiceException · ReaderRepository · TlvEncoder

Method signatures in the Javadoc · All API types