Class PipedInputStream
java.lang.Object
java.io.InputStream
java.io.PipedInputStream
org.apache.olingo.client.core.communication.util.PipedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class is equivalent to
java.io.PipedInputStream. 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.PipedOutputStream.
Multiple readers can read from this stream concurrently. The block asked for
by a reader is delivered completely, or until the end of the stream if less
is available. Other readers can't come in between.- Author:
- WD
-
Field Summary
Fields inherited from class java.io.PipedInputStream
in, out, PIPE_SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates an unconnected PipedInputStream with a default buffer size.PipedInputStream(PipedOutputStream source) Creates a PipedInputStream with a default buffer size and connects it tosource.PipedInputStream(PipedOutputStream source, int bufferSize) Creates a PipedInputStream with buffer sizebufferSizeand connects it tosource. -
Method Summary
Methods inherited from class java.io.PipedInputStream
connect, receiveMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
PipedInputStream
protected PipedInputStream()Creates an unconnected PipedInputStream with a default buffer size. -
PipedInputStream
Creates a PipedInputStream with a default buffer size and connects it tosource.- Throws:
IOException- It was already connected.
-
PipedInputStream
Creates a PipedInputStream with buffer sizebufferSizeand connects it tosource.
-
-
Method Details
-
available
public int available()- Overrides:
availablein classPipedInputStream
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPipedInputStream- Throws:
IOException- The pipe is not connected.
-
connect
- Throws:
IOException- The pipe is already connected.
-
mark
public void mark(int readLimit) - Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
read
- Overrides:
readin classPipedInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classPipedInputStream- Throws:
IOException- The pipe is not connected.
-