FileDocCategorySizeDatePackage
UserInput.javaAPI DocGlassfish v2 API3905Fri May 04 22:25:22 BST 2007com.sun.enterprise.cli.framework

UserInput

public class UserInput extends Object implements IUserInput
This class represents the user is in interactive mode. This class provides the users response.

Fields Summary
private InputStream
mInputStr
private boolean
mInteractive
private BufferedReader
buffRead
Constructors Summary
public UserInput(InputStream in)
Constructor which sets the InputStream and the interactive mode.

param
in is an InputStream object representation of users response.

	mInputStr      =    in;
	mInteractive   =    true;
	buffRead = new BufferedReader(new InputStreamReader(mInputStr));
    
Methods Summary
public voidclose()
Closes the underlying input stream.

	mInputStr.close();
    
public intgetChar()
Returns a Character representation of users response.

	return buffRead.read();
    
public java.lang.StringgetLine()
Returns a String representation of users response. Could be next line in the stream provided.

	//InputStreamReader inStrReader = new InputStreamReader(mInputStr);
	//BufferedReader buffRead = new BufferedReader(inStrReader);
        return buffRead.readLine();
    
public booleanisInteractive()
Returns a boolean which tells the program is in interactive mode.

	return mInteractive;
    
public voidsetEncoding(java.lang.String sEncoding)
Set the character encoding

param
sEncoding - character encoding to set

//	buffRead.close();
	InputStreamReader inStrReader = new InputStreamReader(
	              			    mInputStr, sEncoding);
	buffRead = new BufferedReader(inStrReader);
//	inStrReader.close();