Interface IReaderService
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
ReaderService
Card operations on one connection. Use try-with-resources to release it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases the card connection, including when leaving a try-with-resources block.voidconnect()Connects immediately.voidReleases the owned card connection.Encodes one absolute URI, including HTTP, HTTPS, tel and mailto; no hardware needed.encodeURIs(List<String> urls) Encodes a nonempty list of absolute URIs in order; no hardware needed.read()Reads validated NDEF bytes.default List<NDefContent> Reads supported typed URI, text, contact and Wi-Fi records in order.readURIs()Reads URI strings in order, skipping other supported content types.voidwrite(NDefMessage message) Replaces card content and verifies it by reading back.default voidEncodes and writes a single absolute URI, replacing existing content.
-
Method Details
-
connect
void connect()Connects immediately. Place a card on the reader first; does not wait for insertion. -
disconnect
void disconnect()Releases the owned card connection. Safe to call repeatedly. -
encodeURI
Encodes one absolute URI, including HTTP, HTTPS, tel and mailto; no hardware needed. -
encodeURIs
Encodes a nonempty list of absolute URIs in order; no hardware needed. -
read
NDefMessage read()Reads validated NDEF bytes. Requires connect(); use readContents() for typed values. -
write
Replaces card content and verifies it by reading back. Requires connect(). -
readContents
Reads supported typed URI, text, contact and Wi-Fi records in order. -
readURIs
-
writeURI
Encodes and writes a single absolute URI, replacing existing content. Requires connect(). -
close
void close()Releases the card connection, including when leaving a try-with-resources block.- Specified by:
closein interfaceAutoCloseable
-