summaryrefslogtreecommitdiff
path: root/src/Client/ChatClientWriter.java
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir@cohens.org.il>2013-12-04 10:50:36 +0200
committerTzafrir Cohen <tzafrir@cohens.org.il>2013-12-04 10:50:36 +0200
commit3bbbd95c8d2d6f3185b0f3e48263f36ba4bb0e75 (patch)
treeb336db15d08ab911658a646a6b7f3e6bf011be28 /src/Client/ChatClientWriter.java
parentd57f9416a9d4bb92d4111f73af278f607bbe78b9 (diff)
Convert source to NL-terminated
Diffstat (limited to 'src/Client/ChatClientWriter.java')
-rw-r--r--src/Client/ChatClientWriter.java130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/Client/ChatClientWriter.java b/src/Client/ChatClientWriter.java
index 378008f..8e16655 100644
--- a/src/Client/ChatClientWriter.java
+++ b/src/Client/ChatClientWriter.java
@@ -1,65 +1,65 @@
-package Client;
-import java.io.*;
-import java.net.Socket;
-import java.util.*;
-
-public class ChatClientWriter extends Thread
-{
- private ChatClient client;
- private Socket soc;
- private BufferedWriter output;
-
- public static Scanner reader = new Scanner(System.in);
-
- /** constructor
- * @param the socket and the client info */
- public ChatClientWriter(Socket soc ,ChatClient client)
- {
- this.soc = soc;
- this.client = client;
- }
-
- /** writing the line and making sure the package will be pushed on the stream
- * @param the line and the client info */
- public void println(String line)
- {
- try
- {
- this.output.write(line, 0, line.length());
- this.output.newLine();
- this.output.flush();
-
- } catch (IOException e) {System.err.print("failed to print line" + e);}
-
- }
-
- /** Running the object and translate the output from bytes to letters*/
- public void run()
- {
- try
- {
- OutputStreamWriter outTemp;
- String line;
-
-
- outTemp = new OutputStreamWriter(this.soc.getOutputStream());
- this.output = new BufferedWriter(outTemp);
-
- println("NICK " + client.getNick());
- // 0: mode (nothing special). *: unused in RFC 2812, server name in RFC 1459
- println("USER " + client.getNick() + " 0 * :" + client.getRealname());
-
- while (true)
- {
- System.out.print("Write here: > ");
- line = reader.nextLine();
- this.output.write(line, 0, line.length());
- this.output.newLine();
- this.output.flush();
- }
-
- } catch (IOException e) {}
-
- }
-
-}
+package Client;
+import java.io.*;
+import java.net.Socket;
+import java.util.*;
+
+public class ChatClientWriter extends Thread
+{
+ private ChatClient client;
+ private Socket soc;
+ private BufferedWriter output;
+
+ public static Scanner reader = new Scanner(System.in);
+
+ /** constructor
+ * @param the socket and the client info */
+ public ChatClientWriter(Socket soc ,ChatClient client)
+ {
+ this.soc = soc;
+ this.client = client;
+ }
+
+ /** writing the line and making sure the package will be pushed on the stream
+ * @param the line and the client info */
+ public void println(String line)
+ {
+ try
+ {
+ this.output.write(line, 0, line.length());
+ this.output.newLine();
+ this.output.flush();
+
+ } catch (IOException e) {System.err.print("failed to print line" + e);}
+
+ }
+
+ /** Running the object and translate the output from bytes to letters*/
+ public void run()
+ {
+ try
+ {
+ OutputStreamWriter outTemp;
+ String line;
+
+
+ outTemp = new OutputStreamWriter(this.soc.getOutputStream());
+ this.output = new BufferedWriter(outTemp);
+
+ println("NICK " + client.getNick());
+ // 0: mode (nothing special). *: unused in RFC 2812, server name in RFC 1459
+ println("USER " + client.getNick() + " 0 * :" + client.getRealname());
+
+ while (true)
+ {
+ System.out.print("Write here: > ");
+ line = reader.nextLine();
+ this.output.write(line, 0, line.length());
+ this.output.newLine();
+ this.output.flush();
+ }
+
+ } catch (IOException e) {}
+
+ }
+
+}