Code example for File

Methods: exists

0
    public ScriptLoader(String script){
        this.script = script;
    } 
     
    public String call() throws IOException {
        File f = new File(script);
        if(f.exists())
            return FileUtils.readFileToString(f);
 
        URL url;
        try { 
            url = new URL(script);
        } catch (MalformedURLException e) {
            throw new AbortException("Unable to find a script "+script);
        } 
        InputStream s = url.openStream();
        try { 
            return IOUtils.toString(s);
        } finally { 
            s.close();
        }