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

Support threshold=0 in ThresholdingOutputStream

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.5
    • 2.16.0
    • Streams/Writers
    • None

    Description

      I recently had a case where I would wish threshold=0 to trigger an immediate thresholdReached() in ThresholdingOutputStream(). This seems to me to be a natural expectation. However, thresholdReached() is only triggered after the first byte has been written.

      I'd like to modify the constructor of ThresholdingOutputStream() in that sense. However, as thresholdReached() might throw an IOException, there are two possibilities I'd like to discuss:

      1.) Pass the IOException through. Or, in other words: Modify the constructor to throw an IOException. (Slight binary incompatibility.)
      2.) Catch the IOException, pass on a RuntimeException. Source code compatibility, but surprising for the developer.

      Personally, I'm in favour for 1.)

      Attachments

        Issue Links

          Activity

            People

              jochen@apache.org Jochen Wiedmann
              jochen@apache.org Jochen Wiedmann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: