Author: niallp Date: Tue May 22 09:55:58 2007 New Revision: 540644 URL: http://svn.apache.org/viewvc?view=rev&rev=540644 Log: IO-121 - Add a reset() method to ThresholdingOutputStream which sets the count of the bytes written back to zero - thanks to Tom Nichols for the patch
Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ThresholdingOutputStream.java Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diff&rev=540644&r1=540643&r2=540644 ============================================================================== --- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Tue May 22 09:55:58 2007 @@ -27,6 +27,12 @@ Bug fixes from 1.3.2 -------------------- +Enhancements from 1.3.2 +----------------------- +- ThesholdingOuputStream [IO-121] + - Add a reset() method which sets the count of the bytes written back to zero. + + Feedback -------- Open source works best when you give feedback: Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ThresholdingOutputStream.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ThresholdingOutputStream.java?view=diff&rev=540644&r1=540643&r2=540644 ============================================================================== --- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ThresholdingOutputStream.java (original) +++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ThresholdingOutputStream.java Tue May 22 09:55:58 2007 @@ -217,11 +217,20 @@ { if (!thresholdExceeded && (written + count > threshold)) { - thresholdReached(); thresholdExceeded = true; + thresholdReached(); } } + /** + * Resets the byteCount to zero. You can call this from + * [EMAIL PROTECTED] #thresholdReached()} if you want the event to be triggered again. + */ + protected void reset() + { + this.thresholdExceeded = false; + this.written = 0; + } // ------------------------------------------------------- Abstract methods --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]