Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change EncoderDecoder.Feed.config visibility from private to public #70

Merged
merged 4 commits into from Jan 23, 2023

Conversation

05nelsonm
Copy link
Owner

@05nelsonm 05nelsonm commented Jan 23, 2023

Closes #69

Also adds an example of streaming encoded data to, and decoded data from a File in the sample :app

@05nelsonm 05nelsonm self-assigned this Jan 23, 2023
Copy link
Owner Author

@05nelsonm 05nelsonm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely need to make extension functions for Feed, especially with consuming more things than just a Byte, but Iterables and even the ability to have a transformation lambda there.

File("/tmp/asldkjfasldf").outputStream().use { oStream ->
    val feed = myEncoder.newEncoderFeed { encodedByte ->
        oStream.write(encodedByte.toInt())
    }

    feed.consumeAll("Hello World!")
}

Actually... is consume a better name than update? Feeding, consuming, "Byte" 🤣 ?

Comment on lines +128 to +134
val size: Int = feed.config.decodeOutMaxSize(file.length()).let { size ->
if (size > 4096L) {
4096
} else {
size.toInt()
}
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would make for a fantastic extension function for EncoderDecoder.Config

@05nelsonm 05nelsonm merged commit d731b2e into master Jan 23, 2023
@05nelsonm 05nelsonm deleted the issue/69-feed-config-public branch January 23, 2023 18:23
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.

Make EncoderDecoder.Feed.config public
1 participant