DFU file read fix

This commit is contained in:
rusefi 2020-07-06 21:27:04 -04:00
parent d665e158b8
commit bd26cf0033
1 changed files with 4 additions and 8 deletions

View File

@ -27,17 +27,13 @@ public class DfuImage implements BinaryImage {
private int TargetSize;
private int NumElements;
public DfuImage read(String fileName) {
public DfuImage read(String fileName) throws IOException {
File file = new File(fileName);
this.content = new byte[(int) file.length()];
FileInputStream fileInputStream;
try {
fileInputStream = new FileInputStream(fileName);
fileInputStream.read(this.content);
fileInputStream.close();
} catch (IOException e) {
throw new IllegalStateException(e);
}
fileInputStream = new FileInputStream(fileName);
fileInputStream.read(this.content);
fileInputStream.close();
verifyFile();
return this;
}