Package edu.uiuc.ncsa.sas.cli
Class CLI_IO
- java.lang.Object
-
- edu.uiuc.ncsa.sas.cli.CLI_IO
-
- All Implemented Interfaces:
IOInterface,Runnable
public class CLI_IO extends Object implements IOInterface, Runnable
This implementation of theIOInterfaceis for SAS command line clients. It will do the IO with an SAS server.
-
-
Constructor Summary
Constructors Constructor Description CLI_IO(IOInterface localIO, Client sasClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearQueue()Some implementations will have a queue e.g.protected StringdoExecute(String input)voidflush()Flush anything waiting to be printed.IOInterfacegetLocalIO()protected voidinit()Initialize the service client.booleanisBufferingOn()return current state of buffering.booleanisQueueEmpty()Check if the queue is empty.voidprint(Object x)Print the string representation of an object, without a carriage return.voidprintln(Object x)Print the string representation of an object with a carriage return.Stringreadline()Read a line of input with no prompt.Stringreadline(String prompt)read a line of input, printing the prompt (on the left) first.voidrun()voidsetBufferingOn(boolean bufferOn)If this object supports buffering of commands, this will toggle it.voidsetLocalIO(IOInterface localIO)
-
-
-
Constructor Detail
-
CLI_IO
public CLI_IO(IOInterface localIO, Client sasClient) throws Exception
- Throws:
Exception
-
-
Method Detail
-
getLocalIO
public IOInterface getLocalIO()
-
setLocalIO
public void setLocalIO(IOInterface localIO)
-
readline
public String readline(String prompt) throws IOException
Description copied from interface:IOInterfaceread a line of input, printing the prompt (on the left) first. The prompt is not returned.- Specified by:
readlinein interfaceIOInterface- Returns:
- Throws:
IOException
-
doExecute
protected String doExecute(String input) throws IOException
- Throws:
IOException
-
readline
public String readline() throws IOException
Description copied from interface:IOInterfaceRead a line of input with no prompt.- Specified by:
readlinein interfaceIOInterface- Returns:
- Throws:
IOException
-
print
public void print(Object x)
Description copied from interface:IOInterfacePrint the string representation of an object, without a carriage return.- Specified by:
printin interfaceIOInterface
-
println
public void println(Object x)
Description copied from interface:IOInterfacePrint the string representation of an object with a carriage return.- Specified by:
printlnin interfaceIOInterface
-
flush
public void flush()
Description copied from interface:IOInterfaceFlush anything waiting to be printed. Normally this is done with the print methods.- Specified by:
flushin interfaceIOInterface
-
clearQueue
public void clearQueue()
Description copied from interface:IOInterfaceSome implementations will have a queue e.g. if the user paste text from the clipboard). TheIOInterface.readline(String)methods will queue these up and return them in sequence -- this is done silently. If for some reason you need only a single line and want to discard anything else, invoke this.- Specified by:
clearQueuein interfaceIOInterface
-
isQueueEmpty
public boolean isQueueEmpty()
Description copied from interface:IOInterfaceCheck if the queue is empty.- Specified by:
isQueueEmptyin interfaceIOInterface- Returns:
-
setBufferingOn
public void setBufferingOn(boolean bufferOn)
Description copied from interface:IOInterfaceIf this object supports buffering of commands, this will toggle it. Buffering means that every result ofIOInterface.readline(String)will be stored and up down arrows will cycle through them.- Specified by:
setBufferingOnin interfaceIOInterface
-
isBufferingOn
public boolean isBufferingOn()
Description copied from interface:IOInterfacereturn current state of buffering.- Specified by:
isBufferingOnin interfaceIOInterface- Returns:
-
-