Skip to content

IReaderService

com.rvi.service.IReaderService · Interface · SocialCard 1.0.3

Read, encode and write NDEF through a single card connection.

Use this interface as the type your application depends on. Call connect() before card I/O and use try-with-resources to release the connection. encodeURI() and encodeURIs() work before you connect.

try (final IReaderService reader = ReaderService.create()) {
final NDefMessage message = reader.encodeURI("https://rithush.dev");
reader.connect();
reader.write(message);
System.out.println(reader.readContents());
}
Java imports
import com.rvi.domain.NDefMessage;
import com.rvi.service.IReaderService;
import com.rvi.service.ReaderService;

Use a test tag whose existing contents you can replace.

read() returns validated NDEF bytes. The default readContents() decodes all supported records and readURIs() extracts links in order. writeURI() encodes a single URI and calls write(), which replaces the message and verifies it by reading the tag back. disconnect() releases the connection explicitly and can be called more than once.

ReaderService · NDefMessage · NDefDecoder · CardCapacityException

Method signatures in the Javadoc · All API types