org.crsh.term.spi.jline
Class JLineIO

java.lang.Object
  extended by org.crsh.term.spi.jline.JLineIO
All Implemented Interfaces:
Closeable, TermIO

public class JLineIO
extends Object
implements TermIO

Version:
$Revision$
Author:
Julien Viet

Field Summary
private  StringBuffer buffer
          .
private  short[] keyBindings
          .
private  jline.ConsoleReader reader
          .
 
Constructor Summary
JLineIO()
           
 
Method Summary
 void close()
           
 CodeType decode(int code)
          Decode the intput value.
 void flush()
          Flush output.
 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.
 void write(char c)
          Write a char.
 void write(String s)
          Write a string.
 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

reader

private final jline.ConsoleReader reader
.


keyBindings

private final short[] keyBindings
.


buffer

private StringBuffer buffer
.

Constructor Detail

JLineIO

public JLineIO()
        throws Exception
Throws:
Exception
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

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

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(String 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

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


Copyright © 2012 eXo Platform SAS. All Rights Reserved.