public class ReaderFeeder extends AbstractPipe
implements a Feeder
that feeds data read from a Reader
to the output specified by setOut()
.
Objects of this class can be reused within a single thread.
Constructor and Description |
---|
ReaderFeeder(java.io.Reader source,
java.lang.String csname,
int bsize)
creates the
Feeder to feed in to an
OutputStream while encoding characters with the
character set given by csname . |
Modifier and Type | Method and Description |
---|---|
void |
setOut(java.io.OutputStream out,
boolean closeOnExit)
specifies the
OutputStream where to deliver the
data in the run() method. |
void |
setSource(java.io.Reader in)
specifies the source
java.lang.Reader from which to
fetch the data to feed. |
getException, run, setIn
public ReaderFeeder(java.io.Reader source, java.lang.String csname, int bsize) throws java.nio.charset.UnsupportedCharsetException
creates the Feeder
to feed in
to an
OutputStream
while encoding characters with the
character set given by csname
.
source
- is the Reader
from which to read input
data. May be null
, but then it must be set
with setSource()
before using this object.bsize
- specifies the size of the internal character buffer and
must be greater zerojava.nio.charset.UnsupportedCharsetException
public void setSource(java.io.Reader in)
specifies the source java.lang.Reader
from which to
fetch the data to feed.
Hint: Do not use the inherited method
setIn()
. If you need a Feeder
with an
InputStream
as the source, use Pipe
.
public void setOut(java.io.OutputStream out, boolean closeOnExit)
Feeder
specifies the OutputStream
where to deliver the
data in the run()
method.
setOut
in interface Feeder
setOut
in class AbstractPipe
closeOnExit
- if true, instructs the Feeder
to close
out
before exiting run()
.