-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoom.java
More file actions
39 lines (34 loc) · 838 Bytes
/
Room.java
File metadata and controls
39 lines (34 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package chat;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
/**
* Room class for Socket Programmed Chat
*
* @author Robert Scott - 2018
*/
public class Room {
PrintWriter output; // for logging purposes
/**
* constructor method for Room class
*
* @param l - the filepath of the log file
*/
public Room(String l) {
try {
output = new PrintWriter(new BufferedWriter(new FileWriter(l, true)));
} catch (IOException e) {
System.out.println(" * Error opening log file.");
}
}
/**
* method to append text to log file
*
* @param s - the string to append to log
*/
public void writeLog(String s) {
output.println(s);
output.flush();
}
}