Class PipedOutputStream
java.lang.Object
java.io.OutputStream
java.io.PipedOutputStream
org.apache.olingo.client.core.communication.util.PipedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
This class is equivalent to
java.io.PipedOutputStream. In the
interface it only adds a constructor which allows for specifying the buffer
size. Its implementation, however, is much simpler and a lot more efficient
than its equivalent. It doesn't rely on polling. Instead it uses proper
synchronization with its counterpart be.re.io.PipedInputStream.
Multiple writers can write in this stream concurrently. The block written by
a writer is put in completely. Other writers can't come in between.- Author:
- WD
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates an unconnected PipedOutputStream.Creates a PipedOutputStream with a default buffer size and connects it tosink.PipedOutputStream(PipedInputStream sink, int bufferSize) Creates a PipedOutputStream with buffer sizebufferSizeand connects it tosink. -
Method Summary
Methods inherited from class java.io.PipedOutputStream
connectMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
PipedOutputStream
protected PipedOutputStream()Creates an unconnected PipedOutputStream. -
PipedOutputStream
Creates a PipedOutputStream with a default buffer size and connects it tosink. -
PipedOutputStream
Creates a PipedOutputStream with buffer sizebufferSizeand connects it tosink.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPipedOutputStream- Throws:
IOException- The pipe is not connected.
-
connect
- Throws:
IOException- The pipe is already connected.
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classPipedOutputStream- Throws:
IOException
-
write
- Overrides:
writein classPipedOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classPipedOutputStream- Throws:
IOException- The pipe is not connected or a reader has closed it.
-