[
https://issues.apache.org/jira/browse/IO-152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jukka Zitting updated IO-152:
-----------------------------
Description:
It would be useful to have a ByteArrayOutputStream.readFrom(InputStream) method
to mirror the existing writeTo(OutputStream) method. A call like
baos.readFrom(in) would be semantically the same as IOUtils.copy(in, baos), but
would avoid an extra in-memory copy of the stream contents, as it could read
bytes from the input stream directly into the internal ByteArrayOutputStream
buffers.
[update: renamed the method to write(InputStream) as discussed below]
was:It would be useful to have a ByteArrayOutputStream.readFrom(InputStream)
method to mirror the existing writeTo(OutputStream) method. A call like
baos.readFrom(in) would be semantically the same as IOUtils.copy(in, baos), but
would avoid an extra in-memory copy of the stream contents, as it could read
bytes from the input stream directly into the internal ByteArrayOutputStream
buffers.
Summary: Add ByteArrayOutputStream.write(InputStream) (was: Add
ByteArrayOutputStream.readFrom(InputStream))
OK, let's name it write(InputStream). I'll commit the new method in a moment.
> Add ByteArrayOutputStream.write(InputStream)
> --------------------------------------------
>
> Key: IO-152
> URL: https://issues.apache.org/jira/browse/IO-152
> Project: Commons IO
> Issue Type: New Feature
> Components: Streams/Writers
> Reporter: Jukka Zitting
> Priority: Minor
> Fix For: 1.4
>
> Attachments: IO-152.patch
>
>
> It would be useful to have a ByteArrayOutputStream.readFrom(InputStream)
> method to mirror the existing writeTo(OutputStream) method. A call like
> baos.readFrom(in) would be semantically the same as IOUtils.copy(in, baos),
> but would avoid an extra in-memory copy of the stream contents, as it could
> read bytes from the input stream directly into the internal
> ByteArrayOutputStream buffers.
> [update: renamed the method to write(InputStream) as discussed below]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.