1
Fork 0
mirror of https://github.com/Steffo99/unimore-oop-2020-cleaver.git synced 2024-11-25 17:44:20 +00:00

Fix critical bug

This commit is contained in:
Steffo 2020-01-12 03:26:11 +01:00
parent 592e631b9c
commit 263a51f70c

View file

@ -178,9 +178,10 @@ public class StitchJob extends Job {
byte[] buffer = new byte[BUFFER_SIZE]; byte[] buffer = new byte[BUFFER_SIZE];
int readBytes = inputStream.read(buffer); int readBytes = inputStream.read(buffer);
while(inputStream.read(buffer) != -1) { while(readBytes != -1) {
outputStream.write(buffer, 0, readBytes); outputStream.write(buffer, 0, readBytes);
this.setProgress(new WorkingProgress((float)(resultFile.length() - inputStream.available()) / (float)resultFile.length())); long targetSize = resultFile.length() + inputStream.available();
this.setProgress(new WorkingProgress((float)(resultFile.length()) / (float)targetSize));
readBytes = inputStream.read(buffer); readBytes = inputStream.read(buffer);
} }