org.crsh.term
Interface Term

All Superinterfaces:
Closeable
All Known Implementing Classes:
BaseTerm

public interface Term
extends Closeable

An high level term abstraction.

Version:
$Revision$
Author:
Julien Viet

Method Summary
 void addToHistory(CharSequence line)
          Append a line to the term history.
 void close()
          Close the term.
 CharSequence getBuffer()
          Returns the current buffer;
 Appendable getInsertBuffer()
          Returns the insert buffer, any char appended in the returned appendable will translate into an insertion in the buffer.
 String getProperty(String name)
          Retrieves the value of a property specified by this Term
 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.
 

Method Detail

getWidth

int getWidth()
Returns the term width in chars. When the value is not positive it means the value could not be determined.

Returns:
the term width

getProperty

String getProperty(String name)
Retrieves the value of a property specified by this Term

Parameters:
name - name of the term property
Returns:
value of the term property

setEcho

void setEcho(boolean echo)
Set the echo mode on the term.

Parameters:
echo - the echo mode

read

TermEvent read()
               throws IOException
Read the next term event. This operation is a blocking operation that blocks until data is available or until term is closed.

Returns:
the next term event
Throws:
IOException - any io exception

write

void write(CharSequence msg)
           throws IOException
Write a message on the console, the text will be appended.

Parameters:
msg - the message to write
Throws:
IOException - any io exception

getInsertBuffer

Appendable getInsertBuffer()
Returns the insert buffer, any char appended in the returned appendable will translate into an insertion in the buffer.

Returns:
the insert buffer.

getBuffer

CharSequence getBuffer()
Returns the current buffer;

Returns:
the buffer

addToHistory

void addToHistory(CharSequence line)
Append a line to the term history.

Parameters:
line - the history line to append

close

void close()
Close the term. If threads are blocked in the read() operation, those thread should be unblocked.

Specified by:
close in interface Closeable


Copyright © 2012 eXo Platform SAS. All Rights Reserved.