Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-152

Add ByteArrayOutputStream.write(InputStream)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.4
    • Streams/Writers
    • None

    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]

      Attachments

        1. IO-152.patch
          3 kB
          Jukka Zitting

        Issue Links

          Activity

            People

              jukkaz Jukka Zitting
              jukkaz Jukka Zitting
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: