Package jmri.util
Class ImmediatePipedOutputStream
java.lang.Object
java.io.OutputStream
java.io.PipedOutputStream
jmri.util.ImmediatePipedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Makes a workaround for standard
PipedOutputStream wait.
The PipedInputStream.read(), in case the receive buffer is
empty at the time of the call, waits for up to 1000ms.
PipedOutputStream.write(int) does call sink.receive,
but does not notify() the sink object so that read's
wait() terminates.
As a result, the read side of the pipe waits full 1000ms even though data become available during the wait.
The workaround is to simply PipedOutputStream.flush() after write,
which returns from wait()s immediately.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.PipedOutputStream
close, connect, flushMethods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
ImmediatePipedOutputStream
public ImmediatePipedOutputStream()
-
-
Method Details
-
write
- Overrides:
writein classPipedOutputStream- Throws:
IOException
-
write
- Overrides:
writein classPipedOutputStream- Throws:
IOException
-