Chat-Applikation/src/utils/Client.java

51 lines
1.3 KiB
Java

/*
* Copyright (C) 2021 eichehome
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package utils;
import java.io.IOException;
import java.io.PipedWriter;
/**
*
* @author eichehome
*/
public class Client {
private Thread thread = null;
private PipedWriter pipe = null;
public Client(Thread thread, PipedWriter pipe) {
this.thread = thread;
this.pipe = pipe;
}
public void writePipe(Message message) {
try {
this.pipe.write(message.toString());
} catch (IOException ex) {
System.err.println("Fehler: " + ex);
}
}
public Thread getThread() {
return this.thread;
}
public PipedWriter getPipe() {
return this.pipe;
}
}