Skip to content

Feature/output stream#4

Open
Climbatize wants to merge 3 commits into
aytchell:mainfrom
Yepngo:feature/outputStream
Open

Feature/output stream#4
Climbatize wants to merge 3 commits into
aytchell:mainfrom
Yepngo:feature/outputStream

Conversation

@Climbatize

@Climbatize Climbatize commented Jul 12, 2026

Copy link
Copy Markdown

After I migrated from the original com.github.kenglxn.QRGen lib 3.0.1 I needed an OutputStream method to avoid changing my current architecture.

This PR brings the neew method QrGenerator.writeTo(String, OutputStream) that returns writes to a given OutputStream for a given payload without touching the file system.

you can test my fork by depending on:

{ group = "com.github.yepngo" , name = "qrgen" , version.ref = "3.0.1-yepngo.2" }

Usage:

Java example:

        final byte[] imageBytes;
        try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) {
            generator.writeTo("Hello, World!", output);
            imageBytes = output.toByteArray();
        }

Kotlin example:

        val pngOutputStream = ByteArrayOutputStream()
        
        return pngOutputStream.use { output ->
            generator.writeTo("Hello, World!", output)
            output.toByteArray()
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant