Add 'src/jexer/' from commit 'cf01c92f5809a0732409e280fb0f32f27393618d'
[fanfix.git] / src / jexer / net / TelnetSocket.java
index a1a35f72396aa526943d7c9a2f8381247d0214b9..ac8a2782b0ed672e2166026ffe46439a4bc2681b 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2016 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -38,17 +38,11 @@ import java.net.Socket;
  * establish an 8-bit clean no echo channel and expose window resize events
  * to the Jexer ECMA48 backend.
  */
-public final class TelnetSocket extends Socket {
+public class TelnetSocket extends Socket {
 
-    /**
-     * The telnet-aware socket InputStream.
-     */
-    private TelnetInputStream input;
-
-    /**
-     * The telnet-aware socket OutputStream.
-     */
-    private TelnetOutputStream output;
+    // ------------------------------------------------------------------------
+    // Constants --------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     // Telnet protocol special characters.  Note package private access.
     static final int TELNET_SE         = 240;
@@ -71,6 +65,21 @@ public final class TelnetSocket extends Socket {
     static final int C_LF              = 0x0A;
     static final int C_CR              = 0x0D;
 
+    // ------------------------------------------------------------------------
+    // Variables --------------------------------------------------------------
+    // ------------------------------------------------------------------------
+
+    /**
+     * The telnet-aware socket InputStream.
+     */
+    private TelnetInputStream input;
+
+    /**
+     * The telnet-aware socket OutputStream.
+     */
+    private TelnetOutputStream output;
+
+
     /**
      * If true, this is a server socket (i.e. created by accept()).
      */
@@ -126,14 +135,9 @@ public final class TelnetSocket extends Socket {
      */
     String terminalSpeed = "";
 
-    /**
-     * See if telnet server/client is in ASCII mode.
-     *
-     * @return if true, this connection is in ASCII mode
-     */
-    public boolean isAscii() {
-        return (!binaryMode);
-    }
+    // ------------------------------------------------------------------------
+    // Constructors -----------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /**
      * Creates a Socket that knows the telnet protocol.  Note package private
@@ -145,7 +149,9 @@ public final class TelnetSocket extends Socket {
         super();
     }
 
-    // Socket interface -------------------------------------------------------
+    // ------------------------------------------------------------------------
+    // Socket -----------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /**
      * Returns an input stream for this socket.
@@ -181,4 +187,17 @@ public final class TelnetSocket extends Socket {
         return output;
     }
 
+    // ------------------------------------------------------------------------
+    // TelnetSocket -----------------------------------------------------------
+    // ------------------------------------------------------------------------
+
+    /**
+     * See if telnet server/client is in ASCII mode.
+     *
+     * @return if true, this connection is in ASCII mode
+     */
+    public boolean isAscii() {
+        return (!binaryMode);
+    }
+
 }