org.crsh.term.console
Class Console

java.lang.Object
  extended by org.crsh.term.console.Console

public final class Console
extends Object

This class provides an abstraction for a console. This implementation wraps the input and output of a terminal based on a bidirectional io.

Interactions between terminal and console are done though the ViewReader and ViewWriter classes.

Version:
$Revision$
Author:
Julien Viet

Field Summary
private  char[] buffer
          .
private  int curAt
          Cursor Position, always equal to size unless the underlying *.IO class supports editing.
private  boolean echoing
          Whether or not we do echoing.
private  LinkedList<CharSequence> lines
          .
private  boolean previousCR
          Do we have a issued a CR previously?
private  ConsoleReader reader
          .
private  int size
          .
private  ViewReader viewReader
          .
private  ViewWriter viewWriter
          .
private  ConsoleWriter writer
          .
 
Constructor Summary
Console(ViewWriter viewWriter)
           
 
Method Summary
private  void appendData(char c)
           
private  void appendData(CharSequence s)
           
private  int appendDel()
           
 void clearBuffer()
          Clears the buffer without doing any echoing.
private  void echo(char c)
           
private  void echo(String s)
           
private  void echoCRLF()
           
private  void echoDel()
           
 CharSequence getBuffer()
           
 CharSequence getBufferToCursor()
           
 ConsoleReader getReader()
          Returns the console reader.
 ViewReader getViewReader()
           
 ConsoleWriter getWriter()
           
 boolean isEchoing()
           
private  void moveLeft()
           
private  void moveRight()
           
private  int pop()
           
private  void push(char c)
           
 void setEchoing(boolean echoing)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

private char[] buffer
.


size

private int size
.


curAt

private int curAt
Cursor Position, always equal to size unless the underlying *.IO class supports editing.


lines

private LinkedList<CharSequence> lines
.


previousCR

private boolean previousCR
Do we have a issued a CR previously?


echoing

private boolean echoing
Whether or not we do echoing.


viewWriter

private final ViewWriter viewWriter
.


viewReader

private final ViewReader viewReader
.


reader

private final ConsoleReader reader
.


writer

private final ConsoleWriter writer
.

Constructor Detail

Console

public Console(ViewWriter viewWriter)
Method Detail

clearBuffer

public void clearBuffer()
Clears the buffer without doing any echoing.


getBuffer

public CharSequence getBuffer()

getBufferToCursor

public CharSequence getBufferToCursor()

isEchoing

public boolean isEchoing()

setEchoing

public void setEchoing(boolean echoing)

getReader

public ConsoleReader getReader()
Returns the console reader.

Returns:
the console reader

getViewReader

public ViewReader getViewReader()

getWriter

public ConsoleWriter getWriter()

appendData

private void appendData(CharSequence s)
                 throws IOException
Throws:
IOException

appendData

private void appendData(char c)
                 throws IOException
Throws:
IOException

appendDel

private int appendDel()
               throws IOException
Throws:
IOException

moveRight

private void moveRight()
                throws IOException
Throws:
IOException

moveLeft

private void moveLeft()
               throws IOException
Throws:
IOException

echo

private void echo(char c)
           throws IOException
Throws:
IOException

echo

private void echo(String s)
           throws IOException
Throws:
IOException

echoDel

private void echoDel()
              throws IOException
Throws:
IOException

echoCRLF

private void echoCRLF()
               throws IOException
Throws:
IOException

pop

private int pop()

push

private void push(char c)
           throws IOException
Throws:
IOException


Copyright © 2011 eXo Platform SAS. All Rights Reserved.