Interface QrHandler

All Superinterfaces:
Consumer<String>, WebVerificationHandler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public non-sealed interface QrHandler extends Consumer<String>, WebVerificationHandler
This interface allows to consume a qr code and provides default common implementations to do so
  • Method Details

    • toTerminal

      static QrHandler toTerminal()
      Prints the QR code to the terminal. If your terminal doesn't support utf, you may see random characters.
    • toString

      static QrHandler toString(Consumer<String> smallQrConsumer)
      Transforms the qr code in a UTF-8 string and accepts a consumer for the latter
      Parameters:
      smallQrConsumer - the non-null consumer
    • toPlainString

      static QrHandler toPlainString(Consumer<String> qrConsumer)
      Transforms the qr code in a UTF-8 plain string and accepts a consumer for the latter
      Parameters:
      qrConsumer - the non-null consumer
    • createMatrix

      static com.google.zxing.common.BitMatrix createMatrix(String qr, int size, int margin)
      Utility method to create a matrix from a qr countryCode
      Parameters:
      qr - the non-null source
      size - the size of the qr countryCode
      margin - the margin for the qr countryCode
      Returns:
      a non-null matrix
    • toFile

      static QrHandler toFile(QrHandler.ToFileConsumer fileConsumer)
      Saves the QR code to a temp file
      Parameters:
      fileConsumer - the consumer to digest the created file
    • toFile

      static QrHandler toFile(Path path, QrHandler.ToFileConsumer fileConsumer)
      Saves the QR code to a specified file
      Parameters:
      path - the location where the qr will be written
      fileConsumer - the consumer to digest the created file