I'm using following snippet to download file from internet: How to download and save a file from Internet using Java?
The problem is, that the connection is highly unreliable, so sometimes the file is not download whole.
I there any standard way to get rid of the corrupted file? My program is used as data miner, so I don't care about the particular file, I only need that all downloaded files are correct.
Obviously I thought of handling the IOException
by calling File#delete
method, but I was wondering if there is any automatic way to do it?