org.crsh.telnet.term.processor
Class Processor

java.lang.Object
  extended by org.crsh.telnet.term.processor.Processor
All Implemented Interfaces:
Appendable, Runnable, Screenable, ScreenContext

public final class Processor
extends Object
implements Runnable, ScreenContext


Field Summary
(package private)  Runnable CLOSE_TASK
          .
private static String CONTINUE_PROMPT
          .
(package private)  ProcessContext current
          .
private  LineParser lineBuffer
          .
private  MultiLineVisitor lineVisitor
          .
private  CloseableList listeners
          .
(package private)  Object lock
          .
(package private)  Logger log
          .
(package private) static Runnable NOOP
          .
(package private)  LinkedList<TermEvent> queue
          .
private  Runnable READ_TERM_TASK
          .
(package private)  Shell shell
          .
(package private)  Status status
          .
(package private)  Term term
          .
private  Object termLock
          .
private  boolean termReading
          .
(package private)  boolean waitingEvent
          A flag useful for unit testing to know when the thread is reading.
(package private)  Runnable WRITE_PROMPT_TASK
          .
 
Constructor Summary
Processor(Term term, Shell shell)
           
 
Method Summary
 void addListener(Closeable listener)
           
 Appendable append(char c)
           
 Appendable append(CharSequence s)
           
 Appendable append(CharSequence csq, int start, int end)
           
 Screenable append(Style style)
           
(package private)  void close()
           
 Screenable cls()
           
private  void complete(CharSequence prefix)
           
 void flush()
          Flush the stream.
 int getHeight()
          Returns the screen height in chars.
 int getWidth()
          Returns the screen width in chars.
 boolean isWaitingEvent()
           
(package private)  boolean iterate()
           
(package private)  ProcessContext peekProcess()
           
(package private)  void readTerm()
           
 void run()
           
(package private)  void writePromptFlush()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTINUE_PROMPT

private static final String CONTINUE_PROMPT
.

See Also:
Constant Field Values

NOOP

static final Runnable NOOP
.


WRITE_PROMPT_TASK

final Runnable WRITE_PROMPT_TASK
.


CLOSE_TASK

final Runnable CLOSE_TASK
.


READ_TERM_TASK

private final Runnable READ_TERM_TASK
.


log

final Logger log
.


term

final Term term
.


shell

final Shell shell
.


queue

final LinkedList<TermEvent> queue
.


lock

final Object lock
.


current

ProcessContext current
.


status

Status status
.


waitingEvent

volatile boolean waitingEvent
A flag useful for unit testing to know when the thread is reading.


listeners

private final CloseableList listeners
.


lineBuffer

private final LineParser lineBuffer
.


lineVisitor

private final MultiLineVisitor lineVisitor
.


termLock

private final Object termLock
.


termReading

private boolean termReading
.

Constructor Detail

Processor

public Processor(Term term,
                 Shell shell)
Method Detail

isWaitingEvent

public boolean isWaitingEvent()

run

public void run()
Specified by:
run in interface Runnable

iterate

boolean iterate()
          throws InterruptedException,
                 IOException
Throws:
InterruptedException
IOException

peekProcess

ProcessContext peekProcess()

readTerm

void readTerm()

close

void close()

addListener

public void addListener(Closeable listener)

getWidth

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

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

getHeight

public int getHeight()
Description copied from interface: ScreenContext
Returns the screen height in chars. When the value is not positive it means the value could not be determined.

Specified by:
getHeight in interface ScreenContext
Returns:
the term height

append

public Appendable append(char c)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

append

public Appendable append(CharSequence s)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

append

public Appendable append(CharSequence csq,
                         int start,
                         int end)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

append

public Screenable append(Style style)
                  throws IOException
Specified by:
append in interface Screenable
Throws:
IOException

cls

public Screenable cls()
               throws IOException
Specified by:
cls in interface Screenable
Throws:
IOException

flush

public void flush()
           throws IOException
Description copied from interface: ScreenContext
Flush the stream.

Specified by:
flush in interface ScreenContext
Throws:
IOException - any io exception

writePromptFlush

void writePromptFlush()

complete

private void complete(CharSequence prefix)


Copyright © 2015 eXo Platform SAS. All Rights Reserved.