|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
org.gcube.contentmanagement.baselayer.streamutils.FinishingActionOutputStream
org.gcube.contentmanagement.baselayer.streamutils.CountExceedsActionOutputStream
public class CountExceedsActionOutputStream
This class defines an FinishingActionStreamOutputStream, where in addition, also an Action is triggered everytime the count of written bytes exceeds a defined value.
| Constructor Summary | |
|---|---|
CountExceedsActionOutputStream(java.io.OutputStream wrappedStream,
FinishingAction action,
long countThreshold,
FinishingAction exceedsThresholdAction)
Constructs a new stream |
|
| Method Summary | |
|---|---|
long |
getCountThreshold()
Returns the defined threshold of the count |
FinishingAction |
getExceedsAction()
Returns the action that will be performed to finish |
void |
incrementCount(long valueToAdd)
Increments the value of count by the given value. |
void |
performExceedsAction()
Performs the action for the event of exceeding the defined count |
void |
setCountThreshold(long countThreshold)
Sets the threshold on which the action should happen |
void |
setExceedsAction(FinishingAction exceedsAction)
Sets the action that should be finished when the count is exceeded |
| Methods inherited from class org.gcube.contentmanagement.baselayer.streamutils.FinishingActionOutputStream |
|---|
close, exceptionBeforeFinishing, finish, flush, getCount, getFinishingAction, getWrappedStream, resetCount, resetExceptionBeforeFinishing, setFinishingAction, setWrappedStream, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.gcube.contentmanagement.baselayer.streamutils.FinishingActionStream |
|---|
exceptionBeforeFinishing, finish, getCount, getFinishingAction, getWrappedStream, resetCount, resetExceptionBeforeFinishing, setFinishingAction, setWrappedStream |
| Constructor Detail |
|---|
public CountExceedsActionOutputStream(java.io.OutputStream wrappedStream,
FinishingAction action,
long countThreshold,
FinishingAction exceedsThresholdAction)
wrappedStream - the stream on which the new stream will act as a wrapperaction - the action that should be performed if the end of the stream
is reachedcountThreshold - the thresholdexceedsThresholdAction - the action that should be performed if the threshold is
exceeded of the stream is reached| Method Detail |
|---|
public void incrementCount(long valueToAdd)
throws java.io.IOException
incrementCount in interface FinishingActionStreamincrementCount in class FinishingActionOutputStreamvalueToAdd - the value to add to the counter
java.io.IOException - if something goes wrong
public void performExceedsAction()
throws java.io.IOException
performExceedsAction in interface CountExceedsStreamjava.io.IOException - if something goes wrong on the underlying streampublic long getCountThreshold()
getCountThreshold in interface CountExceedsStreampublic void setCountThreshold(long countThreshold)
setCountThreshold in interface CountExceedsStreamcountThreshold - the thresholdpublic FinishingAction getExceedsAction()
getExceedsAction in interface CountExceedsStreampublic void setExceedsAction(FinishingAction exceedsAction)
setExceedsAction in interface CountExceedsStreamexceedsAction - the action
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||