Is there a not so ugly way of treat the close()
exception to close both streams then:
InputStream in = new FileInputStream(inputFileName);
Here is my answer hopefully much better
https://stackoverflow.com/a/35623998/2585433
try {
fos = new FileOutputStream(new File("..."));
bos = new BufferedOutputStream(fos);
oos = new ObjectOutputStream(bos);
}
catch (Exception e) {
}
finally {
Stream.close(oos,bos,fos);
}
class Stream {
public static void close(AutoCloseable... array) {
for (AutoCloseable c : array) {
try {c.close();}
catch (IOException e) {}
catch (Exception e) {}
}
}
}