Fix file not being sent

This commit is contained in:
Yohan Simard 2021-01-06 10:43:42 +01:00
parent 43ccfe5901
commit 5f0d2ea7b1

View file

@ -15,6 +15,7 @@ public class FileMessage extends Message {
private final String fileName; private final String fileName;
private String path; private String path;
byte[] rawFile = null;
/** /**
* Constructs a FileMessage * Constructs a FileMessage
@ -84,8 +85,10 @@ public class FileMessage extends Message {
} }
// write to the file // write to the file
FileInputStream stream = new FileInputStream(fileName); if (rawFile == null) {
byte[] rawFile = stream.readAllBytes(); FileInputStream stream = new FileInputStream(fileName);
rawFile = stream.readAllBytes();
}
FileOutputStream ostream = new FileOutputStream(file); FileOutputStream ostream = new FileOutputStream(file);
ostream.write(rawFile); ostream.write(rawFile);