public class ConsoleTerm extends Object implements Term
interface
.Modifier and Type | Field and Description |
---|---|
private TermIOBuffer |
buffer
.
|
private LinkedList<CharSequence> |
history
.
|
private CharSequence |
historyBuffer
.
|
private int |
historyCursor
.
|
private TermIO |
io
.
|
private Logger |
log
.
|
private TermIOWriter |
writer
.
|
Constructor and Description |
---|
ConsoleTerm(TermIO io) |
Modifier and Type | Method and Description |
---|---|
void |
addToHistory(CharSequence line)
Append a line to the term history.
|
Appendable |
append(char c) |
Screenable |
append(CharSequence s) |
Appendable |
append(CharSequence csq,
int start,
int end) |
Screenable |
append(Style style) |
void |
close() |
Screenable |
cls() |
void |
flush()
Flush the stream.
|
CharSequence |
getBuffer()
Returns the current buffer content to the cursor;
|
Appendable |
getDirectBuffer()
Returns the direct buffer, any char appended in the returned appendable will translate into an
insertion in the buffer.
|
int |
getHeight()
Returns the screen height in chars.
|
String |
getProperty(String name)
Retrieves the value of a property specified by this Term
|
int |
getWidth()
Returns the screen width in chars.
|
TermEvent |
read()
Read the next term event.
|
boolean |
releaseAlternateBuffer()
Release control of the alternate buffer.
|
void |
setEcho(boolean echo)
Set the echo mode on the term.
|
boolean |
takeAlternateBuffer()
Take control of the alternate buffer.
|
private final LinkedList<CharSequence> history
private CharSequence historyBuffer
private int historyCursor
private final TermIOBuffer buffer
private final TermIOWriter writer
public ConsoleTerm(TermIO io)
public int getWidth()
ScreenContext
getWidth
in interface ScreenContext
public int getHeight()
ScreenContext
getHeight
in interface ScreenContext
public String getProperty(String name)
Term
getProperty
in interface Term
name
- name of the term propertypublic void setEcho(boolean echo)
Term
public boolean takeAlternateBuffer() throws IOException
Term
ScreenContext.flush()
method
is invoked.takeAlternateBuffer
in interface Term
IOException
public boolean releaseAlternateBuffer() throws IOException
Term
ScreenContext.flush()
method
is invoked.releaseAlternateBuffer
in interface Term
IOException
public TermEvent read() throws IOException
Term
read
in interface Term
IOException
- any io exceptionpublic Appendable getDirectBuffer()
Term
getDirectBuffer
in interface Term
public void addToHistory(CharSequence line)
Term
addToHistory
in interface Term
line
- the history line to appendpublic CharSequence getBuffer()
Term
public void flush()
ScreenContext
flush
in interface ScreenContext
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public Screenable append(CharSequence s) throws IOException
append
in interface Appendable
IOException
public Appendable append(char c) throws IOException
append
in interface Appendable
IOException
public Appendable append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
IOException
public Screenable append(Style style) throws IOException
append
in interface Screenable
IOException
public Screenable cls() throws IOException
cls
in interface Screenable
IOException
Copyright © 2015 eXo Platform SAS. All Rights Reserved.