public class Pipe
extends java.lang.Object
Common usage of pipes includes asynchronous zipping of data from two data sources, redirecting output and input to subprocesses and for loggers you want to just pipe from and input source.
com.hypirion.io 0.2.0
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default size of a pipe's buffer.
|
Constructor and Description |
---|
Pipe(java.io.InputStream in,
java.io.OutputStream out)
Creates a new pipe, which redirects data from the stream
in
to the stream out once started. |
Pipe(java.io.InputStream in,
java.io.OutputStream out,
int bufsize)
Creates a new pipe with buffer size
bufsize , which redirects
data from the stream in to the stream out once
started. |
Pipe(java.io.Reader in,
java.io.Writer out)
Creates a new pipe, which redirects data from the reader
in
to the writer out once started. |
Pipe(java.io.Reader in,
java.io.Writer out,
int bufsize)
Creates a new pipe with buffer size
bufsize , which redirects
data from the reader in to the writer out once
started. |
public static final int DEFAULT_BUFFER_SIZE
com.hypirion.io 0.2.0
public Pipe(java.io.InputStream in, java.io.OutputStream out)
in
to the stream out
once started.in
- the input stream to read from.out
- the output stream to write out to.public Pipe(java.io.InputStream in, java.io.OutputStream out, int bufsize)
bufsize
, which redirects
data from the stream in
to the stream out
once
started.in
- the input stream to read from.out
- the output stream to write out to.bufsize
- the buffer size of the pipe.public Pipe(java.io.Reader in, java.io.Writer out)
in
to the writer out
once started.in
- the reader to read from.out
- the writer to write out to.public Pipe(java.io.Reader in, java.io.Writer out, int bufsize)
bufsize
, which redirects
data from the reader in
to the writer out
once
started.in
- the reader to read from.out
- the writer to write out to.bufsize
- the buffer size of the pipe.public void join() throws java.lang.InterruptedException
java.lang.InterruptedException
- if this thread is interrupted while
waiting.stop()
,
stop(boolean)
public void start()
public void pause() throws java.lang.InterruptedException
java.lang.InterruptedException
- if this thread is interrupted while
waiting.pause(boolean)
public void pause(boolean block) throws java.lang.InterruptedException
block
is true, will wait until the
current blocking read by this pipe has finished. Will otherwise notify
this pipe and return immediately.block
- whether to wait for the blocking read (if any) or not.java.lang.InterruptedException
- if this thread is interrupted while
waiting.public void stop() throws java.lang.InterruptedException
java.lang.InterruptedException
- if this thread is interrupted while
waiting.stop(boolean)
public void stop(boolean block) throws java.lang.InterruptedException
block
is true, will wait until the current blocking read by
this pipe has finished. Will otherwise notify this pipe and return
immediately.block
- whether to wait for the blocking read (if any) or not.java.lang.InterruptedException
- if this thread is interrupted while
waiting.