-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: add more conversion methods for JVM streams #1121
Conversation
This comment has been minimized.
This comment has been minimized.
Affected ArtifactsChanged in size
|
* @param inputStream The [InputStream] from which to create a [ByteStream] | ||
* @param contentLength If specified, indicates how many bytes remain in the input stream. Defaults to `null`. | ||
*/ | ||
public fun ByteStream.Companion.fromInputStream( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: just curious, why an alias for InputStream.asByteStream
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a similar alias for File.asByteStream(..)
so it seemed prudent to mirror the pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this PR I think the only operation we're missing is converting an OutputStream
to a ByteStream
. Is that something you think would be useful, should we add it for the sake of completion?
I think we should wait for feature requests or user examples to put something concrete in place for |
Issue #
Closes awslabs/aws-sdk-kotlin#1352
Description of changes
This change adds new methods for converting to/from
ByteStream
and JVM streams:InputStream.asByteStream
: Wrap anInputStream
as aByteStream
ByteStream.fromInputStream
: Alias forInputStream.asByteStream
ByteStream.writeToOutputStream
: Writes the contents of aByteStream
to anOutputStream
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.