org.crsh.term
Class ConsoleTerm

java.lang.Object
  extended by org.crsh.term.ConsoleTerm
All Implemented Interfaces:
Term

public class ConsoleTerm
extends Object
implements Term

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
ConsoleTerm()
           
 
Method Summary
 void addToHistory(CharSequence line)
          Append a line to the term history.
 void bufferInsert(CharSequence msg)
          Insert a message on the console just after the cursor.
 void close()
          Close the term.
 CharSequence getBuffer()
          Returns the current buffer;
 int getWidth()
          Returns the term width in chars.
 TermEvent read()
          Read the next term event.
 void setEcho(boolean echo)
          Set the echo mode on the term.
 void write(CharSequence msg)
          Write a message on the console, the text will be appended.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsoleTerm

public ConsoleTerm()
Method Detail

setEcho

public void setEcho(boolean echo)
Description copied from interface: Term
Set the echo mode on the term.

Specified by:
setEcho in interface Term
Parameters:
echo - the echo mode

getWidth

public int getWidth()
Description copied from interface: Term
Returns the term width in chars. When the value is not positive it means the value could not be determined.

Specified by:
getWidth in interface Term
Returns:
the term width

read

public TermEvent read()
               throws IOException
Description copied from interface: Term
Read the next term event. This operation is a blocking operation that blocks until data is available or until term is closed.

Specified by:
read in interface Term
Returns:
the next term event
Throws:
IOException - any io exception

write

public void write(CharSequence msg)
           throws IOException
Description copied from interface: Term
Write a message on the console, the text will be appended.

Specified by:
write in interface Term
Parameters:
msg - the message to write
Throws:
IOException - any io exception

getBuffer

public CharSequence getBuffer()
Description copied from interface: Term
Returns the current buffer;

Specified by:
getBuffer in interface Term
Returns:
the buffer

bufferInsert

public void bufferInsert(CharSequence msg)
                  throws IOException
Description copied from interface: Term
Insert a message on the console just after the cursor.

Specified by:
bufferInsert in interface Term
Parameters:
msg - the message to insert
Throws:
IOException - any io exception

addToHistory

public void addToHistory(CharSequence line)
Description copied from interface: Term
Append a line to the term history.

Specified by:
addToHistory in interface Term
Parameters:
line - the history line to append

close

public void close()
Description copied from interface: Term
Close the term. If threads are blocked in the Term.read() operation, those thread should be unblocked.

Specified by:
close in interface Term


Copyright © 2011 eXo Platform SAS. All Rights Reserved.