Interface IReaderService

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
ReaderService

public interface IReaderService extends AutoCloseable
Card operations on one connection. Use try-with-resources to release it.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases the card connection, including when leaving a try-with-resources block.
    void
    Connects immediately.
    void
    Releases the owned card connection.
    encodeURI(String message)
    Encodes one absolute URI, including HTTP, HTTPS, tel and mailto; no hardware needed.
    Encodes a nonempty list of absolute URIs in order; no hardware needed.
    Reads validated NDEF bytes.
    default List<NDefContent>
    Reads supported typed URI, text, contact and Wi-Fi records in order.
    default List<String>
    Reads URI strings in order, skipping other supported content types.
    void
    write(NDefMessage message)
    Replaces card content and verifies it by reading back.
    default void
    Encodes 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

      NDefMessage encodeURI(String message)
      Encodes one absolute URI, including HTTP, HTTPS, tel and mailto; no hardware needed.
    • encodeURIs

      NDefMessage encodeURIs(List<String> urls)
      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

      void write(NDefMessage message)
      Replaces card content and verifies it by reading back. Requires connect().
    • readContents

      default List<NDefContent> readContents()
      Reads supported typed URI, text, contact and Wi-Fi records in order.
    • readURIs

      default List<String> readURIs()
      Reads URI strings in order, skipping other supported content types.
    • writeURI

      default void writeURI(String uri)
      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:
      close in interface AutoCloseable