java.lang.Object
com.googlecode.lanterna.terminal.AbstractTerminal
com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal
com.googlecode.lanterna.terminal.ansi.ANSITerminal
com.googlecode.lanterna.terminal.ansi.TelnetTerminal
- All Implemented Interfaces:
Scrollable
,InputProvider
,ExtendedTerminal
,Terminal
,Closeable
,AutoCloseable
This class is used by the
TelnetTerminalServer
class when a client has connected in; this class will be the
interaction point for that client. All operations are sent to the client over the network socket and some of the
meta-operations (like echo mode) are communicated using Telnet negotiation language. You can't create objects of this
class directly; they are created for you when you are listening for incoming connections using a
TelnetTerminalServer
and a client connects.
A good resource on telnet communication is http://www.tcpipguide.com/free/t_TelnetProtocol.htm
Also here: http://support.microsoft.com/kb/231866
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class contains some of the various states that the Telnet negotiation protocol defines.private static interface
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TelnetTerminal.NegotiationState
private final Socket
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
TelnetTerminal
(Socket socket, TelnetTerminal.TelnetClientIACFilterer inputStream, OutputStream outputStream, Charset terminalCharset) (package private)
TelnetTerminal
(Socket socket, Charset terminalCharset) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the socket to the client, effectively ending the telnet session and the terminal.private static int
convertTwoBytesToInt2
(byte b1, byte b2) Retrieves the current negotiation state with the client, containing details on what options have been enabled and what the client has said it supports.Returns the socket address for the remote endpoint of the telnet connectionprivate void
private void
private void
Methods inherited from class com.googlecode.lanterna.terminal.ansi.ANSITerminal
clearScreen, deiconify, disableSGR, enableSGR, enterPrivateMode, exitPrivateMode, findTerminalSize, getCursorPosition, getDefaultKeyDecodingProfile, getTerminalSize, iconify, isInPrivateMode, maximize, pollInput, popTitle, pushTitle, readInput, reportPosition, resetColorAndSGR, restoreCursorPosition, saveCursorPosition, scrollLines, setBackgroundColor, setCursorPosition, setCursorPosition, setCursorVisible, setForegroundColor, setMouseCaptureMode, setTerminalSize, setTitle, unmaximize
Methods inherited from class com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal
bell, enquireTerminal, flush, getCharset, getInputDecoder, putCharacter, putString, resetMemorizedCursorPosition, translateCharacter, waitForCursorPositionReport, writeToTerminal
Methods inherited from class com.googlecode.lanterna.terminal.AbstractTerminal
addResizeListener, newTextGraphics, onResized, onResized, removeResizeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.googlecode.lanterna.terminal.Terminal
addResizeListener, bell, enquireTerminal, flush, newTextGraphics, putCharacter, putString, removeResizeListener
-
Field Details
-
socket
-
negotiationState
-
-
Constructor Details
-
TelnetTerminal
TelnetTerminal(Socket socket, Charset terminalCharset) throws IOException - Throws:
IOException
-
TelnetTerminal
private TelnetTerminal(Socket socket, TelnetTerminal.TelnetClientIACFilterer inputStream, OutputStream outputStream, Charset terminalCharset) throws IOException - Throws:
IOException
-
-
Method Details
-
getRemoteSocketAddress
Returns the socket address for the remote endpoint of the telnet connection- Returns:
- SocketAddress representing the remote client
-
setEchoOff
- Throws:
IOException
-
setLineMode0
- Throws:
IOException
-
setResizeNotificationOn
- Throws:
IOException
-
getNegotiationState
Retrieves the current negotiation state with the client, containing details on what options have been enabled and what the client has said it supports.- Returns:
- The current negotiation state for this client
-
close
Closes the socket to the client, effectively ending the telnet session and the terminal.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceTerminal
- Overrides:
close
in classANSITerminal
- Throws:
IOException
- If there was an underlying I/O error
-
convertTwoBytesToInt2
private static int convertTwoBytesToInt2(byte b1, byte b2)
-