Java URL Download nio canDownload(String filePath)

Here you can find the source of canDownload(String filePath)

Description

can Download

License

Apache License

Declaration

public static boolean canDownload(String filePath) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main {
    public static boolean canDownload(String filePath) {
        try {/*from  w w w .  jav a  2  s.  com*/
            // Cause an exception if the program is already running
            if (new File(filePath).exists()) {
                Files.delete(Paths.get(filePath));
            }

            return true;
        } catch (IOException ignored) {
            return false;
        }
    }
}

Related

  1. download(File dist, URL src)
  2. download(String from, String to)
  3. download(String link, File destFile)
  4. download(String url, File output)