Package org.apache.jackrabbit.vault.util
Class InputStreamPump
java.lang.Object
java.io.InputStream
org.apache.jackrabbit.vault.util.InputStreamPump
- All Implemented Interfaces:
Closeable,AutoCloseable
An input stream pump feeds a
InputStreamPump.Pump in a dedicated thread with the input read from
the given input stream.
This is similar to a TeeInputStream but leverages PipedInputStream and PipedOutputStream
and can execute additional tasks in the additional thread consuming the PipedInputStream.
Only after calling close() the PipedInputStream has been fully consumed (as it waits for the pump's thread to complete).- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
Constructor Details
-
InputStreamPump
- Throws:
IOException
-
-
Method Details
-
getError
Deprecated.Rather callclose(), as otherwise this might be called too early (before the thread finished).close()will automatically wrap the potential exception from the pump in an IOException and throws it as well- Returns:
- exception which has occurred in the pump thread or
null.
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
close(), as otherwise this might be called too early (before the thread finished).