i'm developing an app that needs to download, every some minutes, some files.
Using php, i list all the files and from java i get this list and check for file if is present or not. Once downloaded it, i need to check for integrity because sometimes after the download, some files are corrupted.
try{
    String path = ...
    URL url = new URL(path);
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);         
    conn.setReadTimeout(30000);
    is = conn.getInputStream();
    ReadableByteChannel rbc = Channels.newChannel(is);
    FileOutputStream fos = null;
    fos = new FileOutputStream(local);
    fos.getChannel().transferFrom(rbc, 0, 1 << 24);
    fos.close();
    rbc.close();
} catch (FileNotFoundException e) {
    if(new File(local).exists()) new File(local).delete();
       return false;
} catch (IOException e) {
    if(new File(local).exists()) new File(local).delete();
       return false;
} catch (IOException e) {
    if(new File(local).exists()) new File(local).delete();
       return false;
}
return false;
What can i use in php and java to check for file integrity?
 
     
    