Package org.aesh.terminal.telnet
Class TelnetTtyConnection
java.lang.Object
org.aesh.terminal.telnet.TelnetHandler
org.aesh.terminal.telnet.TelnetTtyConnection
- All Implemented Interfaces:
Appendable,AutoCloseable,org.aesh.terminal.Connection
public final class TelnetTtyConnection
extends TelnetHandler
implements org.aesh.terminal.Connection
A telnet handler that implements
Connection.- Author:
- Julien Viet
-
Constructor Summary
ConstructorsConstructorDescriptionTelnetTtyConnection(boolean inBinary, boolean outBinary, Charset charset, Consumer<org.aesh.terminal.Connection> handler) Creates a new TelnetTtyConnection. -
Method Summary
Modifier and TypeMethodDescriptionorg.aesh.terminal.Attributesvoidclose()org.aesh.terminal.Devicedevice()voidExecutes a task on the connection's event loop.longReturns the timestamp of the last access to this connection.protected voidonClose()The telnet connection closed.protected voidonData(byte[] data) Process data sent by the client.protected voidonOpen(TelnetConnection conn) The telnet connection opened.protected voidonReceiveBinary(boolean binary) Called when the receive binary mode state changes.protected voidonSendBinary(boolean binary) Called when the send binary mode state changes.protected voidonSize(int width, int height) Called when the terminal window size changes.protected voidonTerminalType(String terminalType) Called when the terminal type is received from the client.voidvoidbooleanbooleanreading()voidSchedules a task to be executed after a delay.voidsetAttributes(org.aesh.terminal.Attributes attr) voidsetCloseHandler(Consumer<Void> closeHandler) voidsetSignalHandler(Consumer<org.aesh.terminal.tty.Signal> handler) voidsetSizeHandler(Consumer<org.aesh.terminal.tty.Size> handler) voidsetStdinHandler(Consumer<int[]> handler) Consumer<org.aesh.terminal.tty.Signal>org.aesh.terminal.tty.Sizesize()Consumer<org.aesh.terminal.tty.Size>Consumer<int[]>Consumer<int[]>booleanReturns the terminal type reported by the client.Methods inherited from class org.aesh.terminal.telnet.TelnetHandler
onCommand, onEcho, onNAWS, onSGAMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aesh.terminal.Connection
append, append, append, asPrintWriter, asWriter, close, enterRawMode, setThemeChangeHandler, terminal, themeChangeHandler, write
-
Constructor Details
-
TelnetTtyConnection
public TelnetTtyConnection(boolean inBinary, boolean outBinary, Charset charset, Consumer<org.aesh.terminal.Connection> handler) Creates a new TelnetTtyConnection.- Parameters:
inBinary- true to enable binary mode for inputoutBinary- true to enable binary mode for outputcharset- the charset to use for encoding/decodinghandler- the connection handler to be notified when the connection is established
-
-
Method Details
-
lastAccessedTime
public long lastAccessedTime()Returns the timestamp of the last access to this connection.- Returns:
- the last accessed time in milliseconds since epoch
-
terminalType
Returns the terminal type reported by the client.- Returns:
- the terminal type string, or null if not yet received
-
execute
Executes a task on the connection's event loop.- Parameters:
task- the task to execute
-
schedule
Schedules a task to be executed after a delay.- Parameters:
task- the task to executedelay- the delay before executionunit- the time unit of the delay
-
inputEncoding
- Specified by:
inputEncodingin interfaceorg.aesh.terminal.Connection
-
outputEncoding
- Specified by:
outputEncodingin interfaceorg.aesh.terminal.Connection
-
supportsAnsi
public boolean supportsAnsi()- Specified by:
supportsAnsiin interfaceorg.aesh.terminal.Connection
-
onSendBinary
protected void onSendBinary(boolean binary) Description copied from class:TelnetHandlerCalled when the send binary mode state changes.- Overrides:
onSendBinaryin classTelnetHandler- Parameters:
binary- true if binary mode is enabled for sending, false otherwise
-
onReceiveBinary
protected void onReceiveBinary(boolean binary) Description copied from class:TelnetHandlerCalled when the receive binary mode state changes.- Overrides:
onReceiveBinaryin classTelnetHandler- Parameters:
binary- true if binary mode is enabled for receiving, false otherwise
-
onData
protected void onData(byte[] data) Description copied from class:TelnetHandlerProcess data sent by the client.- Overrides:
onDatain classTelnetHandler- Parameters:
data- the data
-
onOpen
Description copied from class:TelnetHandlerThe telnet connection opened.- Overrides:
onOpenin classTelnetHandler- Parameters:
conn- the connection
-
onTerminalType
Description copied from class:TelnetHandlerCalled when the terminal type is received from the client.- Overrides:
onTerminalTypein classTelnetHandler- Parameters:
terminalType- the terminal type string (e.g., "xterm", "vt100")
-
size
public org.aesh.terminal.tty.Size size()- Specified by:
sizein interfaceorg.aesh.terminal.Connection
-
onSize
protected void onSize(int width, int height) Description copied from class:TelnetHandlerCalled when the terminal window size changes.- Overrides:
onSizein classTelnetHandler- Parameters:
width- the new terminal width in columnsheight- the new terminal height in rows
-
device
public org.aesh.terminal.Device device()- Specified by:
devicein interfaceorg.aesh.terminal.Connection
-
sizeHandler
- Specified by:
sizeHandlerin interfaceorg.aesh.terminal.Connection
-
setSizeHandler
- Specified by:
setSizeHandlerin interfaceorg.aesh.terminal.Connection
-
signalHandler
- Specified by:
signalHandlerin interfaceorg.aesh.terminal.Connection
-
setSignalHandler
- Specified by:
setSignalHandlerin interfaceorg.aesh.terminal.Connection
-
stdinHandler
- Specified by:
stdinHandlerin interfaceorg.aesh.terminal.Connection
-
setStdinHandler
- Specified by:
setStdinHandlerin interfaceorg.aesh.terminal.Connection
-
stdoutHandler
- Specified by:
stdoutHandlerin interfaceorg.aesh.terminal.Connection
-
setCloseHandler
- Specified by:
setCloseHandlerin interfaceorg.aesh.terminal.Connection
-
closeHandler
- Specified by:
closeHandlerin interfaceorg.aesh.terminal.Connection
-
onClose
protected void onClose()Description copied from class:TelnetHandlerThe telnet connection closed.- Overrides:
onClosein classTelnetHandler
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.aesh.terminal.Connection
-
openBlocking
public void openBlocking()- Specified by:
openBlockingin interfaceorg.aesh.terminal.Connection
-
openNonBlocking
public void openNonBlocking()- Specified by:
openNonBlockingin interfaceorg.aesh.terminal.Connection
-
reading
public boolean reading()- Specified by:
readingin interfaceorg.aesh.terminal.Connection
-
put
- Specified by:
putin interfaceorg.aesh.terminal.Connection
-
attributes
public org.aesh.terminal.Attributes attributes()- Specified by:
attributesin interfaceorg.aesh.terminal.Connection
-
setAttributes
public void setAttributes(org.aesh.terminal.Attributes attr) - Specified by:
setAttributesin interfaceorg.aesh.terminal.Connection
-