- All Superinterfaces:
Consumer<String>,WebVerificationSupport
- 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>, WebVerificationSupport
This interface allows to consume a qr code and provides default common implementations to do so
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThis interface allows to consume a file created bytoFile(Path, ToFileConsumer)easily -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic com.google.zxing.common.BitMatrixcreateMatrix(String qr, int size, int margin) Utility method to create a matrix from a qr countryCodestatic QrHandlertoFile(QrHandler.ToFileConsumer fileConsumer) Saves the QR code to a temp filestatic QrHandlertoFile(Path path, QrHandler.ToFileConsumer fileConsumer) Saves the QR code to a specified filestatic QrHandlertoPlainString(Consumer<String> qrConsumer) Transforms the qr code in a UTF-8 plain string and accepts a consumer for the latterstatic QrHandlerTransforms the qr code in a UTF-8 string and accepts a consumer for the latterstatic QrHandlerPrints the QR code to the terminal.
-
Method Details
-
toTerminal
Prints the QR code to the terminal. If your terminal doesn't support utf, you may see random characters. -
toString
Transforms the qr code in a UTF-8 string and accepts a consumer for the latter- Parameters:
smallQrConsumer- the non-null consumer
-
toPlainString
Transforms the qr code in a UTF-8 plain string and accepts a consumer for the latter- Parameters:
qrConsumer- the non-null consumer
-
createMatrix
Utility method to create a matrix from a qr countryCode- Parameters:
qr- the non-null sourcesize- the size of the qr countryCodemargin- the margin for the qr countryCode- Returns:
- a non-null matrix
-
toFile
Saves the QR code to a temp file- Parameters:
fileConsumer- the consumer to digest the created file
-
toFile
Saves the QR code to a specified file- Parameters:
path- the location where the qr will be writtenfileConsumer- the consumer to digest the created file
-