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.writeInt(amount);
writer.write(bytes, 0, amount); writer.write(bytes, 0, amount);
} }
writer.writeInt(0);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }
@ -48,9 +49,13 @@ public class FileHeader {
void receive(DataInputStream reader) { void receive(DataInputStream reader) {
try { try {
String relative = reader.readUTF(); String relative = reader.readUTF();
DataOutputStream writer = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(relative)));
int size = 0;
DataOutputStream writer = new DataOutputStream(new BufferedOutputStream(new FileOutputStream())); 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){ } catch (Exception ignored){
} }
} }