public class FastPipedInputStream extends InputStream
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 FastPipedOutputStream
.FastPipedOutputStream
Constructor and Description |
---|
FastPipedInputStream()
Creates an unconnected PipedInputStream with a default buffer size.
|
FastPipedInputStream(FastPipedOutputStream source)
Creates a PipedInputStream with a default buffer size and connects it to
source . |
FastPipedInputStream(FastPipedOutputStream 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(FastPipedOutputStream source) |
protected void |
finalize() |
void |
mark(int readLimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
reset, skip
public FastPipedInputStream()
public FastPipedInputStream(FastPipedOutputStream source) throws IOException
source
.IOException
- It was already connected.public FastPipedInputStream(FastPipedOutputStream source, int bufferSize) throws IOException
bufferSize
and
connects it to source
.IOException
- It was already connected.public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
- The pipe is not connected.public void connect(FastPipedOutputStream source) throws IOException
IOException
- The pipe is already connected.protected void finalize() throws Throwable
public void mark(int readLimit)
mark
in class InputStream
public boolean markSupported()
markSupported
in class InputStream
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
- The pipe is not connected.Copyright © 2016. All rights reserved.