public class PipedInputStream extends PipedInputStream
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.in, out, PIPE_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
PipedInputStream()
Creates an unconnected PipedInputStream with a default buffer size.
|
|
PipedInputStream(PipedOutputStream source)
Creates a PipedInputStream with a default buffer size and connects it to
source. |
|
PipedInputStream(PipedOutputStream source,
int bufferSize)
Creates a PipedInputStream with buffer size
bufferSize and
connects it to source. |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
void |
connect(PipedOutputStream source) |
void |
mark(int readLimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
connect, receivereset, skipprotected PipedInputStream()
public PipedInputStream(PipedOutputStream source)
source.IOException - It was already connected.public PipedInputStream(PipedOutputStream source, int bufferSize)
bufferSize and
connects it to source.public int available()
available in class PipedInputStreampublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class PipedInputStreamIOException - The pipe is not connected.public void connect(PipedOutputStream source) throws IOException
IOException - The pipe is already connected.public void mark(int readLimit)
mark in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic int read()
throws IOException
read in class PipedInputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class PipedInputStreamIOException - The pipe is not connected.Copyright © 2023. All rights reserved.