[
https://issues.apache.org/jira/browse/IO-121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13813866#comment-13813866
]
Jochen Wiedmann commented on IO-121:
------------------------------------
Keep in mind that the user could likely achieve the same effect by creating a
new instance of ThresholdingOutputStream with the same target, thus eliminating
the need for blowing up the API.
> Allowing ThesholdingOuputStream to reset written and thresholdExceeded values?
> ------------------------------------------------------------------------------
>
> Key: IO-121
> URL: https://issues.apache.org/jira/browse/IO-121
> Project: Commons IO
> Issue Type: Improvement
> Components: Streams/Writers
> Affects Versions: 1.3
> Environment: Any
> Reporter: Tom Nichols
> Assignee: Niall Pemberton
> Priority: Trivial
> Fix For: 1.4
>
> Attachments: TOS-reset.patch, ThresholdingOutputStream.java
>
>
> please add a protected reset() method to ThresholdingOutputStream that will
> reset the byteCount and thresholdExceeded values:
> protected void reset()
> {
> this.thresholdExceeded = false;
> this.written = 0;
> }
> The order of operations for the base checkThreshold(int) method will need to
> be changed to allow reset() to be properly called from thresholdReached():
> protected void checkThreshold(int count) throws IOException
> {
> if (!thresholdExceeded && (written + count > threshold))
> {
> thresholdExceeded = true;
> thresholdReached(); //call comes _after_ thresholdExceeded =
> true.
> }
> }
--
This message was sent by Atlassian JIRA
(v6.1#6144)