-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChatThread.java
38 lines (29 loc) · 879 Bytes
/
ChatThread.java
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
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ChatThread implements Runnable{
private ObjectInputStream in;
private String s;
public ChatThread(ObjectInputStream in){
this.in=in;
}
public void run(){
try {
s=(String) in.readObject();
} catch (IOException ex) {
Logger.getLogger(ChatThread.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(ChatThread.class.getName()).log(Level.SEVERE, null, ex);
}
}
public String msg(){
return s;
}
public void stp(){
try {
in.close();
} catch (IOException ex) {
Logger.getLogger(ChatThread.class.getName()).log(Level.SEVERE, null, ex);
}
}
}