ioexceptions

How can I handle an IOException which I know can never be thrown, in a safe and readable manner?

"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair." -Douglas Adams I have an class FileItems. FileItems constructor takes a file, and throws an exce...

Safest way to copy a file

Hello, I need to merg two PDF files. However sometimes a file might be locked up I wrote this code, but I'm wondering if it's not the smartest solution: private static int FILE_LOCKED_WAIT_PERIOD = 1000; while (true) { // If the file is in use, IOException will be thrown. ...