I am using Apache FTPClient
for the Android. I download files from the server and overwrite them instead of local ones. I need to make sure that the files were downloaded correctly. Will the method FTPClient.retrieveFile
work for me? Does it check the correctness of the file or just overwrite it immediately? I. e. if the broken file was downloaded (for example the Internet disconnect), then on the local device I will receive old version of the file or broken?
Apache Commons Net FTPClient.retrieveFile
does not work with any local files directly. It takes OutputStream
as a parameter and blindly writes the downloaded data to it.
It is up to the OutputStream
, what it does with the data.
If you use FileOutputStream
, it will overwrite the existing file immediately – even before you actually call FTPClient.retrieveFile
.
If you need any other behavior, you have to code it.