main
Brett 2023-11-10 16:13:18 -05:00
parent c7bf3e8974
commit a6e42a8934
1 changed files with 8 additions and 3 deletions

View File

@ -41,6 +41,7 @@ public class FileHeader {
writer.writeInt(amount);
writer.write(bytes, 0, amount);
}
writer.writeInt(0);
} catch (Exception ignored) {
}
}
@ -48,9 +49,13 @@ public class FileHeader {
void receive(DataInputStream reader) {
try {
String relative = reader.readUTF();
DataOutputStream writer = new DataOutputStream(new BufferedOutputStream(new FileOutputStream()));
DataOutputStream writer = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(relative)));
int size = 0;
while ((size = reader.readInt()) > 0){
byte[] data = new byte[size];
int amount = reader.read(data, 0, size);
writer.write(data, 0, amount);
}
} catch (Exception ignored){
}
}