|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.taskdefs.Redirector
public class Redirector
The Redirector class manages the setup and connection of input and output redirection for an Ant project component.
Constructor Summary | |
---|---|
Redirector(ProjectComponent managingTask)
Create a redirector instance for the given task |
|
Redirector(Task managingTask)
Create a redirector instance for the given task |
Method Summary | |
---|---|
void |
complete()
Complete redirection. |
ExecuteStreamHandler |
createHandler()
Create the StreamHandler to use with our Execute instance. |
void |
createStreams()
Create the input, error and output streams based on the configuration options. |
java.io.OutputStream |
getErrorStream()
Get the error stream for the redirector |
java.io.InputStream |
getInputStream()
Get the input stream for the redirector |
java.io.OutputStream |
getOutputStream()
Get the output stream for the redirector |
protected void |
handleErrorFlush(java.lang.String output)
Handle a flush operation on the error stream |
protected void |
handleErrorOutput(java.lang.String output)
Process error output |
protected void |
handleFlush(java.lang.String output)
Process data due to a flush operation. |
protected int |
handleInput(byte[] buffer,
int offset,
int length)
Handle an input request |
protected void |
handleOutput(java.lang.String output)
Pass output sent to System.out to specified output. |
void |
setAlwaysLog(boolean alwaysLog)
If true, (error and non-error) output will be "teed", redirected as specified while being sent to Ant's logging mechanism as if no redirection had taken place. |
void |
setAppend(boolean append)
Whether output should be appended to or overwrite an existing file. |
void |
setAppendProperties(boolean appendProperties)
This Redirector 's subordinate
PropertyOutputStream s will not set their respective
properties while (appendProperties && append) . |
void |
setCreateEmptyFiles(boolean createEmptyFiles)
Whether output and error files should be created even when empty. |
void |
setError(java.io.File error)
Set the file to which standard error is to be redirected. |
void |
setError(java.io.File[] error)
Set the files to which standard error is to be redirected. |
void |
setErrorEncoding(java.lang.String errorEncoding)
Set the error encoding. |
void |
setErrorFilterChains(java.util.Vector errorFilterChains)
Set the error FilterChain s. |
void |
setErrorProperty(java.lang.String errorProperty)
Property name whose value should be set to the error of the process. |
void |
setInput(java.io.File input)
Set the input to use for the task |
void |
setInput(java.io.File[] input)
Set the input to use for the task |
void |
setInputEncoding(java.lang.String inputEncoding)
Set the input encoding. |
void |
setInputFilterChains(java.util.Vector inputFilterChains)
Set the input FilterChain s. |
void |
setInputString(java.lang.String inputString)
Set the string to use as input |
void |
setLogError(boolean logError)
Controls whether error output of exec is logged. |
void |
setLogInputString(boolean logInputString)
Set whether to include the value of the input string in log messages. |
void |
setOutput(java.io.File out)
File the output of the process is redirected to. |
void |
setOutput(java.io.File[] out)
Files the output of the process is redirected to. |
void |
setOutputEncoding(java.lang.String outputEncoding)
Set the output encoding. |
void |
setOutputFilterChains(java.util.Vector outputFilterChains)
Set the output FilterChain s. |
void |
setOutputProperty(java.lang.String outputProperty)
Property name whose value should be set to the output of the process. |
void |
setProperties()
Notify the Redirector that it is now okay
to set any output and/or error properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Redirector(Task managingTask)
managingTask
- the task for which the redirector is to workpublic Redirector(ProjectComponent managingTask)
managingTask
- the project component for which the
redirector is to workMethod Detail |
---|
public void setInput(java.io.File input)
input
- the file from which input is read.public void setInput(java.io.File[] input)
input
- the files from which input is read.public void setInputString(java.lang.String inputString)
inputString
- the string which is used as the input sourcepublic void setLogInputString(boolean logInputString)
logInputString
- true or false.public void setOutput(java.io.File out)
out
- the file to which output stream is writtenpublic void setOutput(java.io.File[] out)
out
- the files to which output stream is writtenpublic void setOutputEncoding(java.lang.String outputEncoding)
outputEncoding
- String
.public void setErrorEncoding(java.lang.String errorEncoding)
errorEncoding
- String
.public void setInputEncoding(java.lang.String inputEncoding)
inputEncoding
- String
.public void setLogError(boolean logError)
logError
- if true the standard error is sent to the Ant log system
and not sent to output.public void setAppendProperties(boolean appendProperties)
Redirector
's subordinate
PropertyOutputStream
s will not set their respective
properties while (appendProperties && append)
.
appendProperties
- whether to append properties.public void setError(java.io.File error)
error
- the file to which error is to be writtenpublic void setError(java.io.File[] error)
error
- the file to which error is to be writtenpublic void setOutputProperty(java.lang.String outputProperty)
outputProperty
- the name of the property to be set with the
task's output.public void setAppend(boolean append)
append
- if true output and error streams are appended to their
respective files, if specified.public void setAlwaysLog(boolean alwaysLog)
alwaysLog
- boolean
public void setCreateEmptyFiles(boolean createEmptyFiles)
createEmptyFiles
- boolean
.public void setErrorProperty(java.lang.String errorProperty)
errorProperty
- the name of the property to be set
with the error output.public void setInputFilterChains(java.util.Vector inputFilterChains)
FilterChain
s.
inputFilterChains
- Vector
containing FilterChain
.public void setOutputFilterChains(java.util.Vector outputFilterChains)
FilterChain
s.
outputFilterChains
- Vector
containing FilterChain
.public void setErrorFilterChains(java.util.Vector errorFilterChains)
FilterChain
s.
errorFilterChains
- Vector
containing FilterChain
.public void createStreams()
public ExecuteStreamHandler createHandler() throws BuildException
BuildException
- if the execute stream handler cannot be created.protected void handleOutput(java.lang.String output)
output
- the data to be outputprotected int handleInput(byte[] buffer, int offset, int length) throws java.io.IOException
buffer
- the buffer into which data is to be read.offset
- the offset into the buffer at which data is stored.length
- the amount of data to read
java.io.IOException
- if the data cannot be readprotected void handleFlush(java.lang.String output)
output
- the data being flushed.protected void handleErrorOutput(java.lang.String output)
output
- the error output data.protected void handleErrorFlush(java.lang.String output)
output
- the error information being flushed.public java.io.OutputStream getOutputStream()
public java.io.OutputStream getErrorStream()
public java.io.InputStream getInputStream()
public void complete() throws java.io.IOException
java.io.IOException
- if the output properties cannot be read from their
output streams.public void setProperties()
Redirector
that it is now okay
to set any output and/or error properties.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |