Class TelnetTerminal
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 classThis class contains some of the various states that the Telnet negotiation protocol defines.private static interfaceprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TelnetTerminal.NegotiationStateprivate final Socket -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTelnetTerminal(Socket socket, TelnetTerminal.TelnetClientIACFilterer inputStream, OutputStream outputStream, Charset terminalCharset) (package private)TelnetTerminal(Socket socket, Charset terminalCharset) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the socket to the client, effectively ending the telnet session and the terminal.private static intconvertTwoBytesToInt2(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 voidprivate voidprivate voidMethods inherited from class 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, unmaximizeMethods inherited from class StreamBasedTerminal
bell, enquireTerminal, flush, getCharset, getInputDecoder, putCharacter, putString, resetMemorizedCursorPosition, translateCharacter, waitForCursorPositionReport, writeToTerminalMethods inherited from class AbstractTerminal
addResizeListener, newTextGraphics, onResized, onResized, removeResizeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTerminal- Overrides:
closein classANSITerminal- Throws:
IOException- If there was an underlying I/O error
-
convertTwoBytesToInt2
private static int convertTwoBytesToInt2(byte b1, byte b2)
-