public class OutputStreamFunneler extends Object
OutputStream
s to
write to a single underlying stream, which is
closed only when the last "funnel"
has been closed.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIMEOUT_MILLIS
Default timeout.
|
Constructor and Description |
---|
OutputStreamFunneler(OutputStream out)
Create a new
OutputStreamFunneler for
the specified OutputStream . |
OutputStreamFunneler(OutputStream out,
long timeoutMillis)
Create a new
OutputStreamFunneler for
the specified OutputStream , with the
specified timeout value. |
Modifier and Type | Method and Description |
---|---|
OutputStream |
getFunnelInstance()
Get a "funnel"
OutputStream instance to
write to this OutputStreamFunneler 's underlying
OutputStream . |
void |
setTimeout(long timeoutMillis)
Set the timeout for this
OutputStreamFunneler . |
public static final long DEFAULT_TIMEOUT_MILLIS
setTimeout(long)
,
Constant Field Valuespublic OutputStreamFunneler(OutputStream out)
OutputStreamFunneler
for
the specified OutputStream
.out
- OutputStream
.public OutputStreamFunneler(OutputStream out, long timeoutMillis)
OutputStreamFunneler
for
the specified OutputStream
, with the
specified timeout value.out
- OutputStream
.timeoutMillis
- long
.setTimeout(long)
public OutputStream getFunnelInstance() throws IOException
OutputStream
instance to
write to this OutputStreamFunneler
's underlying
OutputStream
.OutputStream
.IOException
- if unable to create the funnel.public void setTimeout(long timeoutMillis)
OutputStreamFunneler
.
This is the maximum time that may elapse between the closure
of the last "funnel" and the next call to
getOutputStream()
without closing the
underlying stream.timeoutMillis
- long
timeout value.