Package org.apache.tools.ant.util
Class OutputStreamFunneler
java.lang.Object
org.apache.tools.ant.util.OutputStreamFunneler
public class OutputStreamFunneler
extends java.lang.Object
Manages a set of
OutputStream
s to
write to a single underlying stream, which is
closed only when the last "funnel"
has been closed.-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_TIMEOUT_MILLIS
Default timeout. -
Constructor Summary
Constructors Constructor Description OutputStreamFunneler(java.io.OutputStream out)
Create a newOutputStreamFunneler
for the specifiedOutputStream
.OutputStreamFunneler(java.io.OutputStream out, long timeoutMillis)
Create a newOutputStreamFunneler
for the specifiedOutputStream
, with the specified timeout value. -
Method Summary
Modifier and Type Method Description java.io.OutputStream
getFunnelInstance()
Get a "funnel"OutputStream
instance to write to thisOutputStreamFunneler
's underlyingOutputStream
.void
setTimeout(long timeoutMillis)
Set the timeout for thisOutputStreamFunneler
.
-
Field Details
-
DEFAULT_TIMEOUT_MILLIS
public static final long DEFAULT_TIMEOUT_MILLISDefault timeout.- See Also:
setTimeout(long)
, Constant Field Values
-
-
Constructor Details
-
OutputStreamFunneler
public OutputStreamFunneler(java.io.OutputStream out)Create a newOutputStreamFunneler
for the specifiedOutputStream
.- Parameters:
out
-OutputStream
.
-
OutputStreamFunneler
public OutputStreamFunneler(java.io.OutputStream out, long timeoutMillis)Create a newOutputStreamFunneler
for the specifiedOutputStream
, with the specified timeout value.- Parameters:
out
-OutputStream
.timeoutMillis
-long
.- See Also:
setTimeout(long)
-
-
Method Details
-
setTimeout
public void setTimeout(long timeoutMillis)Set the timeout for thisOutputStreamFunneler
. This is the maximum time that may elapse between the closure of the last "funnel" and the next call togetOutputStream()
without closing the underlying stream.- Parameters:
timeoutMillis
-long
timeout value.
-
getFunnelInstance
public java.io.OutputStream getFunnelInstance() throws java.io.IOExceptionGet a "funnel"OutputStream
instance to write to thisOutputStreamFunneler
's underlyingOutputStream
.- Returns:
OutputStream
.- Throws:
java.io.IOException
- if unable to create the funnel.
-