Package com.storedobject.common
Class InputOutputStream
java.lang.Object
com.storedobject.common.InputOutputStream
A class that combines an
InputStream
and an OutputStream
. One thread may be writing to it and another
may be reading from it.- Author:
- Syam
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with a default buffer size of 8K.InputOutputStream
(int bufferSize) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Abort the streams.Get the input stream for reading.Get the output stream for writing to it.final boolean
Check whether this is reusable or not.void
Set an exception to the input stream so that someone will get it when they try to read something from it.void
setReusable
(boolean reusable) Set this in 'reusable' mode.
-
Constructor Details
-
InputOutputStream
public InputOutputStream()Constructor with a default buffer size of 8K. -
InputOutputStream
public InputOutputStream(int bufferSize) Constructor.- Parameters:
bufferSize
- Buffer size
-
-
Method Details
-
getInputStream
-
getOutputStream
Get the output stream for writing to it.- Returns:
- Output stream.
-
isReusable
public final boolean isReusable()Check whether this is reusable or not. (When set to 'reusable' mode, the buffer will be reset and it will possible to start reading from and writing to it again.)- Returns:
- True or false.
-
setReusable
public void setReusable(boolean reusable) Set this in 'reusable' mode. (When set to 'reusable' mode, the buffer will be reset and it will possible to start reading from and writing to it again.)- Parameters:
reusable
- True or false
-
abort
public void abort()Abort the streams. After this operation, this can not be reused too. -
setExternalException
Set an exception to the input stream so that someone will get it when they try to read something from it.- Parameters:
e
- Exception to set.
-