Is there a not so ugly way of treat the close()
exception to close both streams then:
InputStream in = new FileInputStream(inputFileName);
In most cases the 'in' close() exception is irrelevant, so:
try {
copy(in, out);
} finally {
try { in.close() } catch (Exception e) { /* perhaps log it */ }
try { out.close() } catch (Exception e) {/* perhaps log it */ }
}
It's usually bad practice to swallow exceptions, but in this case I think it's ok.