com.cedarsoft.utils
Class DefaultCmdLine

java.lang.Object
  extended by com.cedarsoft.utils.AbstractCmdLine
      extended by com.cedarsoft.utils.DefaultCmdLine
All Implemented Interfaces:
CmdLine

public class DefaultCmdLine
extends AbstractCmdLine

The default command line


Constructor Summary
DefaultCmdLine()
           
 
Method Summary
protected  ConsolePrinter getConsolePrinter()
           
 java.io.InputStream getIn()
           
 java.io.PrintStream getOut()
           
static boolean isAnsiAware()
           
 void pause(int seconds)
          Pauses the script
 java.lang.String read(java.lang.String message)
          Reads a string form the console
 java.lang.String read(java.lang.String message, java.lang.String defaultValue)
          Reads a string from the console.
 boolean readBoolean(java.lang.String message)
          Reads a boolean from the command line
 int readInt(java.lang.String message)
          Reads an int from the console
 int readInt(java.lang.String message, int lower, int upper)
          Reads an int from the console
 
Methods inherited from class com.cedarsoft.utils.AbstractCmdLine
error, out, out, outNl, printPossibleElements, read, read, read, readSelection, readSelection, success, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCmdLine

public DefaultCmdLine()
Method Detail

isAnsiAware

public static boolean isAnsiAware()

getConsolePrinter

@NotNull
protected ConsolePrinter getConsolePrinter()
Specified by:
getConsolePrinter in class AbstractCmdLine

readBoolean

public boolean readBoolean(@NotNull
                           java.lang.String message)
                    throws java.io.IOException
Description copied from interface: CmdLine
Reads a boolean from the command line

Parameters:
message - the message that is shown
Returns:
the value the user has entered
Throws:
java.io.IOException

read

@NotNull
public java.lang.String read(@NotNull
                                     java.lang.String message)
Description copied from interface: CmdLine
Reads a string form the console

Parameters:
message - the mssage
Returns:
the string

read

@NotNull
public java.lang.String read(@NotNull
                                     java.lang.String message,
                                     @Nullable
                                     java.lang.String defaultValue)
Description copied from interface: CmdLine
Reads a string from the console. The user may optinally select the given default value

Parameters:
message - the message
defaultValue - the default value
Returns:
the string

getIn

@NotNull
public java.io.InputStream getIn()

getOut

@NotNull
public java.io.PrintStream getOut()
Specified by:
getOut in class AbstractCmdLine

readInt

public int readInt(@NotNull
                   java.lang.String message,
                   int lower,
                   int upper)
Description copied from interface: CmdLine
Reads an int from the console

Parameters:
message - the message
lower - the lower bounds
upper - the upper bounds
Returns:
the read int

readInt

public int readInt(@NotNull
                   java.lang.String message)
            throws java.io.IOException
Description copied from interface: CmdLine
Reads an int from the console

Parameters:
message - the message
Returns:
the int
Throws:
java.io.IOException

pause

public void pause(int seconds)
Description copied from interface: CmdLine
Pauses the script

Parameters:
seconds - the seconds that it is paused


Copyright © 2009 cedarsoft GmbH. All Rights Reserved.