org.crsh.ssh.term
Class SSHIO

java.lang.Object
  extended by org.crsh.ssh.term.SSHIO
All Implemented Interfaces:
Closeable, TermIO

public class SSHIO
extends Object

    
implements TermIO

    


Field Summary
private static int BACKWARD_WORD
          .
(package private)  AtomicBoolean closed
          .
private  CRaSHCommand command
          .
private static int DOWN
          Copied from net.wimpi.telnetd.io.TerminalIO.
private static int FORWARD_WORD
          .
private static int HANDLED
          Copied from net.wimpi.telnetd.io.TerminalIO.
private static int LEFT
          Copied from net.wimpi.telnetd.io.TerminalIO.
private static Logger log
          .
private  Reader reader
          .
private static int RIGHT
          Copied from net.wimpi.telnetd.io.TerminalIO.
private  int status
          .
private static int STATUS_NORMAL
          .
private static int STATUS_READ_ESC_1
          .
private static int STATUS_READ_ESC_2
          .
private static int UP
          Copied from net.wimpi.telnetd.io.TerminalIO.
private  boolean useAlternate
          .
private  Writer writer
          .
 
Constructor Summary
SSHIO(CRaSHCommand command)
           
 
Method Summary
 void close()
           
 void cls()
          Clear screen.
 CodeType decode(int code)
          Decode the intput value.
 void flush()
          Flush output.
 int getHeight()
          Returns the term height in chars.
 String getProperty(String name)
          Retrieves the value of a property specified by this TermIO
 int getWidth()
          Returns the term width in chars.
 boolean moveLeft()
          Move the cursor left.
 boolean moveRight(char c)
          Move the cursor right.
 int read()
          Reads an input value.
 boolean releaseAlternateBuffer()
          Release control of the alternate buffer.
 boolean takeAlternateBuffer()
          Take control of the alternate buffer.
 void write(char c)
          Write a char.
 void write(CharSequence s)
          Write a string.
 void write(Style d)
          Write a style.
 void writeCRLF()
          Write a CRLF.
 void writeDel()
          Delete the char under the cursor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UP

private static final int UP
Copied from net.wimpi.telnetd.io.TerminalIO.

See Also:
Constant Field Values

DOWN

private static final int DOWN
Copied from net.wimpi.telnetd.io.TerminalIO.

See Also:
Constant Field Values

RIGHT

private static final int RIGHT
Copied from net.wimpi.telnetd.io.TerminalIO.

See Also:
Constant Field Values

LEFT

private static final int LEFT
Copied from net.wimpi.telnetd.io.TerminalIO.

See Also:
Constant Field Values

HANDLED

private static final int HANDLED
Copied from net.wimpi.telnetd.io.TerminalIO.

See Also:
Constant Field Values

BACKWARD_WORD

private static final int BACKWARD_WORD
.

See Also:
Constant Field Values

FORWARD_WORD

private static final int FORWARD_WORD
.

See Also:
Constant Field Values

log

private static final Logger log
.


reader

private final Reader reader
.


writer

private final Writer writer
.


STATUS_NORMAL

private static final int STATUS_NORMAL
.

See Also:
Constant Field Values

STATUS_READ_ESC_1

private static final int STATUS_READ_ESC_1
.

See Also:
Constant Field Values

STATUS_READ_ESC_2

private static final int STATUS_READ_ESC_2
.

See Also:
Constant Field Values

status

private int status
.


command

private final CRaSHCommand command
.


closed

final AtomicBoolean closed
.


useAlternate

private boolean useAlternate
.

Constructor Detail

SSHIO

public SSHIO(CRaSHCommand command)
Method Detail

read

public int read()
         throws IOException
Description copied from interface: TermIO
Reads an input value.

Specified by:
read in interface TermIO
Returns:
the value read
Throws:
IOException - any io exception

getWidth

public int getWidth()
Description copied from interface: TermIO
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 TermIO
Returns:
the term width

getHeight

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

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

getProperty

public String getProperty(String name)
Description copied from interface: TermIO
Retrieves the value of a property specified by this TermIO

Specified by:
getProperty in interface TermIO
Parameters:
name - the name of the property
Returns:
value of the property

takeAlternateBuffer

public boolean takeAlternateBuffer()
                            throws IOException
Description copied from interface: TermIO
Take control of the alternate buffer. When the alternate buffer is already used nothing happens. The buffer switch should occur when then TermIO.flush() method is invoked.

Specified by:
takeAlternateBuffer in interface TermIO
Returns:
true if the alternate buffer is shown
Throws:
IOException

releaseAlternateBuffer

public boolean releaseAlternateBuffer()
                               throws IOException
Description copied from interface: TermIO
Release control of the alternate buffer. When the normal buffer is already used nothing happens. The buffer switch should occur when then TermIO.flush() method is invoked.

Specified by:
releaseAlternateBuffer in interface TermIO
Returns:
true if the usual buffer is shown
Throws:
IOException

decode

public CodeType decode(int code)
Description copied from interface: TermIO
Decode the intput value.

Specified by:
decode in interface TermIO
Parameters:
code - the code
Returns:
the input value type

close

public void close()
Specified by:
close in interface Closeable

flush

public void flush()
           throws IOException
Description copied from interface: TermIO
Flush output.

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

write

public void write(CharSequence s)
           throws IOException
Description copied from interface: TermIO
Write a string.

Specified by:
write in interface TermIO
Parameters:
s - the string to write
Throws:
IOException - any io exception

write

public void write(char c)
           throws IOException
Description copied from interface: TermIO
Write a char.

Specified by:
write in interface TermIO
Parameters:
c - the char to write
Throws:
IOException - any io exception

write

public void write(Style d)
           throws IOException
Description copied from interface: TermIO
Write a style.

Specified by:
write in interface TermIO
Parameters:
d - the data to write
Throws:
IOException - any io exception

writeDel

public void writeDel()
              throws IOException
Description copied from interface: TermIO
Delete the char under the cursor.

Specified by:
writeDel in interface TermIO
Throws:
IOException - any io exception

writeCRLF

public void writeCRLF()
               throws IOException
Description copied from interface: TermIO
Write a CRLF.

Specified by:
writeCRLF in interface TermIO
Throws:
IOException - any io exception

moveRight

public boolean moveRight(char c)
                  throws IOException
Description copied from interface: TermIO
Move the cursor right.

Specified by:
moveRight in interface TermIO
Parameters:
c - the char skipped over
Returns:
true if the cursor moved.
Throws:
IOException - any io exception

moveLeft

public boolean moveLeft()
                 throws IOException
Description copied from interface: TermIO
Move the cursor left.

Specified by:
moveLeft in interface TermIO
Returns:
true if the cursor moved
Throws:
IOException - any io exception

cls

public void cls()
         throws IOException
Description copied from interface: TermIO
Clear screen.

Specified by:
cls in interface TermIO
Throws:
IOException - any io exception


Copyright © 2014 eXo Platform SAS. All Rights Reserved.