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

Add ByteArrayOutputStream.toInputStream()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4
    • 2.5
    • Streams/Writers
    • None

    Description

      It would be useful to have a toInputStream() method for reading the stored data without allocating a new full size byte array by calling toByteArray().

      A flag has been added so reset() do not try to reuse buffers that are currently used by an InputStream. I think this fixes the safety/consistency issue raised in IO-137.

      Test cases for the new method with and without reset being called are included in the patch.

      Attachments

        1. toInputStream.patch
          5 kB
          Fredrik Kjellberg

        Issue Links

          Activity

            People

              Unassigned Unassigned
              frkj Fredrik Kjellberg
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: