All Packages Class Hierarchy This Package Previous Next Index
Class key.TelnetConnection
java.lang.Object
|
+----key.Atom
|
+----key.InteractiveConnection
|
+----key.TelnetConnection
- public class TelnetConnection
- extends InteractiveConnection
Works closely with the 'Terminal' class
to achieve different terminal emulations
Implements RFCs: 1091, 858, 857, 854, 885, 1143,
855, 1073
-
canPageEver
-
-
CRLF
-
-
DEFAULT_HEIGHT
-
-
DEFAULT_WIDTH
-
-
INPUT_BUFFER
-
-
MAX_OVERRUN
-
-
PAGER_LACKS_PAGES
-
-
PAGER_THRESHOLD
- The number of lines less than the terminal height
which is the border between paging and not paging
-
PAGER_VERTICAL_SPACE
- The amount of additional space the pager reserves
at the bottom of the screen.
-
SMALLEST_BELIEVABLE_HEIGHT
-
-
SMALLEST_BELIEVABLE_WIDTH
-
-
TelnetConnection(Socket)
- Constructor
-
blankLine()
- leave some blank space (usually the height of the characters
-
canPage()
-
-
check()
- This function will be called every 'now and
again', as a 'check' function when no input
is required (we're not waiting), but some
is allowed.
-
dashes(int)
- Returns a string of the specified number of dashes
This routine has been optimised for up to 70 spaces,
requesting more than this will slow it down.
-
drawNextPage()
-
-
flush()
-
-
flushLine()
- flush()'s, with a newline as well
-
forceTerminal(String)
- Terminals can be autodetected, or overridden by 'forcing'
them (using, incidently, this routine)
-
getTerminal()
-
-
hiddenInput(String)
- This function is very similar to
input(), above, except that it should be
used to *not* echo text as it's entered,
mainly for passwords
-
input(String)
- This function blocks until a line of input is
recieved.
-
isPaging()
- returns true if we need to output a 'paging' prompt
-
paragraph(String, int, int, int, int, boolean, boolean, boolean)
- A not-so-trivial routine that does word-wrap'ing WITH
colour codes, and outputs the result through the
pager (if required) down the users terminal.
-
quitPager()
-
-
resetTerminal()
-
-
send(char, String)
-
-
send(Paragraph)
-
-
send(Paragraph, boolean)
-
-
send(String)
-
-
sendColumnParagraph(ColumnParagraph, boolean, boolean)
-
-
sendHeadingParagraph(String, int, boolean, boolean)
-
-
sendLine()
- draw a line across the screen
-
sendRaw(String)
- This function sends this raw text to the
players screen.
-
sendSubliminal(String, int, int)
- You never know what they _might_ have available on their terminal...
-
sendTableParagraph(TableParagraph, boolean, boolean)
-
-
sendText(String)
- Meant to be used to send part of what would
normally be a paragraph.
-
sendTextParagraph(int, int, int, int, String, int, boolean, boolean)
-
-
setCanPage(boolean)
-
-
setDetectedTerminal(String)
-
-
spaces(int)
- Returns a string of the specified number of spaces
This routine has been optimised for up to 70 spaces,
requesting more than this will slow it down.
SMALLEST_BELIEVABLE_WIDTH
public static final int SMALLEST_BELIEVABLE_WIDTH
SMALLEST_BELIEVABLE_HEIGHT
public static final int SMALLEST_BELIEVABLE_HEIGHT
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH
DEFAULT_HEIGHT
public static final int DEFAULT_HEIGHT
PAGER_VERTICAL_SPACE
public static final int PAGER_VERTICAL_SPACE
- The amount of additional space the pager reserves
at the bottom of the screen. 3 allows one blank
line and a message line, without forcing a scroll.
PAGER_THRESHOLD
public static final int PAGER_THRESHOLD
- The number of lines less than the terminal height
which is the border between paging and not paging
PAGER_LACKS_PAGES
public static final String PAGER_LACKS_PAGES
canPageEver
public boolean canPageEver
CRLF
public static final String CRLF
INPUT_BUFFER
public static final int INPUT_BUFFER
MAX_OVERRUN
public static final int MAX_OVERRUN
TelnetConnection
public TelnetConnection(Socket s)
- Constructor
- Parameters:
- s - The socket that the connection is on
setDetectedTerminal
public boolean setDetectedTerminal(String name)
forceTerminal
public boolean forceTerminal(String name)
- Terminals can be autodetected, or overridden by 'forcing'
them (using, incidently, this routine)
resetTerminal
public void resetTerminal()
getTerminal
public Terminal getTerminal()
check
public void check() throws IOException
- This function will be called every 'now and
again', as a 'check' function when no input
is required (we're not waiting), but some
is allowed. This is useful for the telnet
protocol in particular, which can recieve
IAC's before the login prompt. This function
should be harmless, no matter when its called
- Overrides:
- check in class InteractiveConnection
input
public String input(String prompt) throws IOException
- This function blocks until a line of input is
recieved. Think of it as being much like the
input statement in BASIC of old. *shudder*
- Parameters:
- prompt - The prompt to give the player
- Overrides:
- input in class InteractiveConnection
hiddenInput
public String hiddenInput(String prompt) throws IOException
- This function is very similar to
input(), above, except that it should be
used to *not* echo text as it's entered,
mainly for passwords
- Overrides:
- hiddenInput in class InteractiveConnection
sendRaw
public void sendRaw(String message)
- This function sends this raw text to the
players screen. It shouldn't really be
used very often - far better to classify
data better (from a future expansion pov).
\n is *not* appended to the end of this string
- Overrides:
- sendRaw in class InteractiveConnection
sendLine
public void sendLine()
- draw a line across the screen
- Overrides:
- sendLine in class InteractiveConnection
send
public void send(String message)
- Overrides:
- send in class InteractiveConnection
sendText
public void sendText(String message)
- Meant to be used to send part of what would
normally be a paragraph.
- Overrides:
- sendText in class InteractiveConnection
flush
protected void flush()
flushLine
protected void flushLine()
- flush()'s, with a newline as well
send
public void send(char qualifier,
String message)
- Overrides:
- send in class InteractiveConnection
sendTextParagraph
protected void sendTextParagraph(int li,
int ri,
int lfi,
int rfi,
String message,
int alignment,
boolean appending,
boolean okayToPage)
sendColumnParagraph
protected void sendColumnParagraph(ColumnParagraph tp,
boolean appending,
boolean okayToPage)
sendTableParagraph
protected void sendTableParagraph(TableParagraph tp,
boolean appending,
boolean okayToPage)
sendHeadingParagraph
protected void sendHeadingParagraph(String message,
int alignment,
boolean appending,
boolean okayToPage)
send
public final void send(Paragraph para)
- Overrides:
- send in class InteractiveConnection
send
public void send(Paragraph para,
boolean okayToPage)
- Overrides:
- send in class InteractiveConnection
blankLine
public void blankLine()
- leave some blank space (usually the height of the characters
- Overrides:
- blankLine in class InteractiveConnection
sendSubliminal
public void sendSubliminal(String message,
int duration,
int frequency)
- You never know what they _might_ have available on their terminal...
*grin*
- Overrides:
- sendSubliminal in class InteractiveConnection
paragraph
public void paragraph(String message,
int li,
int ri,
int lfi,
int rfi,
boolean stripLeadingSpaces,
boolean appending,
boolean okayToPage)
- A not-so-trivial routine that does word-wrap'ing WITH
colour codes, and outputs the result through the
pager (if required) down the users terminal.
(Funny... this routine was a lot harder to write
in C++)
Anything put in preLine is additional to the left
indent - so to guarantee a left indent of 4, ensure
you subtract the length of preLine
Setting prelines that are wider than the
terminal has an undefined effect on the output.
- Parameters:
- message - The text to format
- li - Leftedge Indent
- ri - Rightedge Indent
- lfi - Leftedge Firstline Indent (in addition to the leftedge)
- rfi - Rightedge Firstline Indent (in addition to the rightedge)
- preLine - A string constant to put at the start of every line
canPage
public boolean canPage()
setCanPage
public void setCanPage(boolean b)
isPaging
public boolean isPaging()
- returns true if we need to output a 'paging' prompt
- Overrides:
- isPaging in class InteractiveConnection
quitPager
public void quitPager()
drawNextPage
public void drawNextPage()
spaces
public static String spaces(int n)
- Returns a string of the specified number of spaces
This routine has been optimised for up to 70 spaces,
requesting more than this will slow it down.
dashes
public static String dashes(int n)
- Returns a string of the specified number of dashes
This routine has been optimised for up to 70 spaces,
requesting more than this will slow it down.
All Packages Class Hierarchy This Package Previous Next Index