Top Description Constructors Methods
org.apache.tools.ant.input

public Class DefaultInputHandler

extends Object
implements InputHandler
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.input.InputHandler
Known Direct Subclasses
org.apache.tools.ant.input.GreedyInputHandler, org.apache.tools.ant.input.SecureInputHandler
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, org.apache.tools.ant.BuildException, org.apache.tools.ant.util.KeepAliveInputStream

Prompts on System.err, reads input from System.in
Since
Ant 1.5

Constructor Summary

AccessConstructor and Description
public
DefaultInputHandler()

Empty no-arg constructor

Method Summary

Modifier and TypeMethod and Description
protected InputStream

Returns:

the input stream from which the user input should be read.
getInputStream
()

Returns the input stream from which the user input should be read.

protected String

Returns:

the prompt to ask the user
getPrompt
(InputRequest
the request to construct the prompt for. Must not be null.
request
)

Constructs user prompt from a request.

public void
handleInput(InputRequest
the request to handle
request
)

Implements org.apache.tools.ant.input.InputHandler.handleInput.

Prompts and requests input.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DefaultInputHandlerback to summary
public DefaultInputHandler()

Empty no-arg constructor

Method Detail

getInputStreamback to summary
protected InputStream getInputStream()

Returns the input stream from which the user input should be read.

Returns:InputStream

the input stream from which the user input should be read.

getPromptback to summary
protected String getPrompt(InputRequest request)

Constructs user prompt from a request.

This implementation adds (choice1,choice2,choice3,...) to the prompt for MultipleChoiceInputRequests.

Parameters
request:InputRequest

the request to construct the prompt for. Must not be null.

Returns:String

the prompt to ask the user

handleInputback to summary
public void handleInput(InputRequest request) throws BuildException

Implements org.apache.tools.ant.input.InputHandler.handleInput.

Prompts and requests input. May loop until a valid input has been entered.

Parameters
request:InputRequest

the request to handle

Exceptions
BuildException:
if not possible to read from console