Package jline
Class TerminalSupport
- java.lang.Object
-
- jline.TerminalSupport
-
- All Implemented Interfaces:
Terminal
- Direct Known Subclasses:
OSvTerminal
,UnixTerminal
,UnsupportedTerminal
,WindowsTerminal
public abstract class TerminalSupport extends java.lang.Object implements Terminal
Provides support forTerminal
instances.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
ansiSupported
static int
DEFAULT_HEIGHT
static int
DEFAULT_WIDTH
private boolean
echoEnabled
private ShutdownHooks.Task
shutdownTask
private boolean
supported
-
Constructor Summary
Constructors Modifier Constructor Description protected
TerminalSupport(boolean supported)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disableInterruptCharacter()
void
enableInterruptCharacter()
int
getHeight()
java.lang.String
getOutputEncoding()
int
getWidth()
boolean
hasWeirdWrap()
Defaults to true which was the behaviour before this method was added.void
init()
boolean
isAnsiSupported()
boolean
isEchoEnabled()
boolean
isSupported()
void
reset()
void
restore()
protected void
setAnsiSupported(boolean supported)
void
setEchoEnabled(boolean enabled)
java.io.InputStream
wrapInIfNeeded(java.io.InputStream in)
When using native support, return the InputStream to use for reading characters else return the input stream passed as a parameter.java.io.OutputStream
wrapOutIfNeeded(java.io.OutputStream out)
Subclass to change behavior if needed.
-
-
-
Field Detail
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH
- See Also:
- Constant Field Values
-
DEFAULT_HEIGHT
public static final int DEFAULT_HEIGHT
- See Also:
- Constant Field Values
-
shutdownTask
private ShutdownHooks.Task shutdownTask
-
supported
private boolean supported
-
echoEnabled
private boolean echoEnabled
-
ansiSupported
private boolean ansiSupported
-
-
Method Detail
-
init
public void init() throws java.lang.Exception
-
restore
public void restore() throws java.lang.Exception
-
reset
public void reset() throws java.lang.Exception
-
isSupported
public final boolean isSupported()
- Specified by:
isSupported
in interfaceTerminal
-
isAnsiSupported
public boolean isAnsiSupported()
- Specified by:
isAnsiSupported
in interfaceTerminal
-
setAnsiSupported
protected void setAnsiSupported(boolean supported)
-
wrapOutIfNeeded
public java.io.OutputStream wrapOutIfNeeded(java.io.OutputStream out)
Subclass to change behavior if needed.- Specified by:
wrapOutIfNeeded
in interfaceTerminal
- Returns:
- the passed out
-
hasWeirdWrap
public boolean hasWeirdWrap()
Defaults to true which was the behaviour before this method was added.- Specified by:
hasWeirdWrap
in interfaceTerminal
-
isEchoEnabled
public boolean isEchoEnabled()
- Specified by:
isEchoEnabled
in interfaceTerminal
-
setEchoEnabled
public void setEchoEnabled(boolean enabled)
- Specified by:
setEchoEnabled
in interfaceTerminal
-
disableInterruptCharacter
public void disableInterruptCharacter()
- Specified by:
disableInterruptCharacter
in interfaceTerminal
-
enableInterruptCharacter
public void enableInterruptCharacter()
- Specified by:
enableInterruptCharacter
in interfaceTerminal
-
wrapInIfNeeded
public java.io.InputStream wrapInIfNeeded(java.io.InputStream in) throws java.io.IOException
Description copied from interface:Terminal
When using native support, return the InputStream to use for reading characters else return the input stream passed as a parameter.- Specified by:
wrapInIfNeeded
in interfaceTerminal
- Throws:
java.io.IOException
-
getOutputEncoding
public java.lang.String getOutputEncoding()
- Specified by:
getOutputEncoding
in interfaceTerminal
-
-