This commit is contained in:
Andrin Fassbind
2022-04-16 21:12:55 +02:00
parent 77e9cf6163
commit 6498b8ab33
3 changed files with 6 additions and 4 deletions
@@ -1,9 +1,11 @@
package ch.zhaw.pm2.multichat.protocol;
import java.io.Serializable;
/**
* A Message object represents one Message of a client. Can be stored in ClientMessageList.
*/
public class Message {
public class Message implements Serializable {
private final ConnectionHandler.DATA_TYPE type;
private String sender;
private final String receiver;
@@ -320,9 +320,9 @@ public class NetworkHandler {
* @throws IOException if an error occours. (e.g. terminated locally/remotely) see above.
* @throws ClassNotFoundException if the data object received does not match any class in the local classpath
*/
public T receive() throws IOException, ClassNotFoundException {
public Message receive() throws IOException, ClassNotFoundException {
ObjectInputStream inputStream = new ObjectInputStream(this.socket.getInputStream());
return (T) inputStream.readObject();
return (Message) inputStream.readObject();
}
/**