diff options
author | Tzafrir Cohen <tzafrir@cohens.org.il> | 2013-12-04 10:50:36 +0200 |
---|---|---|
committer | Tzafrir Cohen <tzafrir@cohens.org.il> | 2013-12-04 10:50:36 +0200 |
commit | 3bbbd95c8d2d6f3185b0f3e48263f36ba4bb0e75 (patch) | |
tree | b336db15d08ab911658a646a6b7f3e6bf011be28 /src/Client/ChatClientReader.java | |
parent | d57f9416a9d4bb92d4111f73af278f607bbe78b9 (diff) |
Convert source to NL-terminated
Diffstat (limited to 'src/Client/ChatClientReader.java')
-rw-r--r-- | src/Client/ChatClientReader.java | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/src/Client/ChatClientReader.java b/src/Client/ChatClientReader.java index 2183d90..7cc7f07 100644 --- a/src/Client/ChatClientReader.java +++ b/src/Client/ChatClientReader.java @@ -1,65 +1,65 @@ -package Client;
-import java.net.Socket;
-import java.util.*;
-import java.io.*;
-
-import javax.swing.JTextArea;
-
-public class ChatClientReader extends Thread
-{
- public static Scanner reader = new Scanner(System.in);
- private Socket soc;
- private JTextArea display;
- UserInterface ui;
-
- /** constructor
- * @param the socket */
- public ChatClientReader (Socket soc)
- {
- this.soc = soc;
- }
-
- public void setDisplay (UserInterface ui)
- {
- this.ui = ui;
- }
-
- /** Running the object and translate the input from bytes to letters*/
- public void run()
- {
- try
- {
-
- String line ;
-
- InputStreamReader inputTemp = new InputStreamReader(this.soc.getInputStream());
- BufferedReader input = new BufferedReader(inputTemp);
-
- do {
- line = input.readLine(); // FIXME: more then 1 line
- if (line == null)
- {
- soc.close();
- }
- line = "[" + line + "]";
- System.out.println("");
- System.out.println(line);
-
- ui.outputWriter(line);
- this.display.append(line + "\n");
-
-
-
- } while (line != null);
-
-
- } catch (IOException e) {
- System.err.println(e);
- return;
- }
-
-
-
- }
-
-}
+package Client; +import java.net.Socket; +import java.util.*; +import java.io.*; + +import javax.swing.JTextArea; + +public class ChatClientReader extends Thread +{ + public static Scanner reader = new Scanner(System.in); + private Socket soc; + private JTextArea display; + UserInterface ui; + + /** constructor + * @param the socket */ + public ChatClientReader (Socket soc) + { + this.soc = soc; + } + + public void setDisplay (UserInterface ui) + { + this.ui = ui; + } + + /** Running the object and translate the input from bytes to letters*/ + public void run() + { + try + { + + String line ; + + InputStreamReader inputTemp = new InputStreamReader(this.soc.getInputStream()); + BufferedReader input = new BufferedReader(inputTemp); + + do { + line = input.readLine(); // FIXME: more then 1 line + if (line == null) + { + soc.close(); + } + line = "[" + line + "]"; + System.out.println(""); + System.out.println(line); + + ui.outputWriter(line); + this.display.append(line + "\n"); + + + + } while (line != null); + + + } catch (IOException e) { + System.err.println(e); + return; + } + + + + } + +} |