You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Tom Nichols (JIRA)" <ji...@apache.org> on 2007/05/22 18:21:16 UTC

[jira] Updated: (IO-121) Allowing ThesholdingOuputStream to reset written and thresholdExceeded values?

     [ https://issues.apache.org/jira/browse/IO-121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom Nichols updated IO-121:
---------------------------

    Attachment: TOS-reset.patch

patch.

> 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
>            Priority: Trivial
>         Attachments: ThresholdingOutputStream.java, TOS-reset.patch
>
>
> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org