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

Add ByteArrayOutputStream.toInputStream()

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.5
    • Component/s: Streams/Writers
    • Labels:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: