Searches for a ScriptEngine that can handle the given file.

@param file the file to search a ScriptEngine for.
@return the ScriptEngine or <code>null</code> if none is found.
544716
protected ScriptEngine getScriptEngine(File file)
    {
        final String extension = getExtension(file.getName());
        if (extension == null)
        {
            return null;
        }

        return getScriptEngineManager().getEngineByExtension(extension);
    }
829206
public static void deleteFile(File file)
    {
        Check.notNull(file);

        try
        {
            Files.delete(file.toPath());
        }
        catch (final IOException exception)
        {
            throw new LionEngineException(exception, ERROR_DELETE_FILE + file.getAbsolutePath());
        }
    }
600480
private boolean hasSlf4jBinding(File file) throws MojoExecutionException {
        try (JarFile jarFile = new JarFile(file)){
            return jarFile.getEntry("org/slf4j/impl/StaticLoggerBinder.class") != null;
        } catch (IOException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
1354512
private static InputStream inputFor( File file)
    {
    try
      {
      return
        file == null
        ? null
        : new FileInputStream( file);
      }
    catch( Exception e)
      {
      throw new IllegalArgumentException( "Can't open file=" + file);
      }
    }
337365
public Script parse(File file) throws CompilationFailedException, IOException {
        return parse(new GroovyCodeSource(file, config.getSourceEncoding()));
    }
241672
private static Attributes getJarMainAttributes(final File file) {
        debug("getJarMainAttributes: " + file);

        try {
            try(final JarInputStream jarInputStream = new JarInputStream(new FileInputStream(file))){
                return jarInputStream.getManifest().getMainAttributes();
            }
        } catch (IOException e) {
            return null;
        }
    }
577006
private Object getScriptResult(String script, ScriptEngine engine) throws ScriptException {
        String scriptToExecute = script.substring(script.indexOf(":") + 1);
        return engine.eval(scriptToExecute);
    }
569611
public void loadTagMappingFile(String file) {
        if (file != null) {
            File f = new File(file);
            if (!f.exists()) {
                throw new IllegalArgumentException("tag mapping file parameter points to a file that does not exist");
            }
            if (f.isDirectory()) {
                throw new IllegalArgumentException("tag mapping file parameter points to a directory, must be a file");
            } else if (!f.canRead()) {
                throw new IllegalArgumentException(
                        "tag mapping file parameter points to a file we have no read permissions");
            }

            try {
                this.tagMapping = f.toURI().toURL();
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
            }
        } else {
            this.tagMapping = PoiWriterTask.class.getClassLoader().getResource("poi-mapping.xml");
        }
    }
287900
public static Style getStyleFromFile( File file ) {
        Style style = null;
        try {
            String name = file.getName();
            if (!name.endsWith("sld")) {
                String nameWithoutExtention = FileUtilities.getNameWithoutExtention(file);
                File sldFile = new File(file.getParentFile(), nameWithoutExtention + ".sld");
                if (sldFile.exists()) {
                    file = sldFile;
                } else {
                    // no style file here
                    return null;
                }
            }

            SLDHandler h = new SLDHandler();
            StyledLayerDescriptor sld = h.parse(file, null, null, null);
//            SLDParser stylereader = new SLDParser(sf, file);
//            StyledLayerDescriptor sld = stylereader.parseSLD();
            style = getDefaultStyle(sld);
            return style;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
18086
public static @NonNull ClickEvent openFile(final @NonNull String file) {
    return new ClickEvent(Action.OPEN_FILE, file);
  }
662243
public static Layout forFile(File file) {
		if (file == null) {
			throw new IllegalArgumentException("File must not be null");
		}
		String lowerCaseFileName = file.getName().toLowerCase(Locale.ENGLISH);
		if (lowerCaseFileName.endsWith(".jar")) {
			return new Jar();
		}
		if (lowerCaseFileName.endsWith(".war")) {
			return new War();
		}
		if (file.isDirectory() || lowerCaseFileName.endsWith(".zip")) {
			return new Expanded();
		}
		throw new IllegalStateException("Unable to deduce layout for '" + file + "'");
	}
1203441
public static Properties loadFile(File file) throws IOException {
		InputStream input = new FileInputStream(file);
		Properties prop = null;
		try {
			prop = load(input);
		} finally {
			IOUtils.close(input);
		}
		return prop;
	}
1009092
public InputStream getInput(File file) throws FileNotFoundException {
      return file != null ? getInput(file.getPath()) : null;
   }
464844
public static FileObject toFileObject(File file) {
        if (file == null) {
            return null;
        }
        try {
            return getFileSystemManager().toFileObject(file);
        } catch (FileSystemException e) {
            throw new IllegalStateException(e);
        }
    }
1124116
public static String getExtension(File file)
    {
        Check.notNull(file);

        return getExtension(file.getName());
    }
106061
public ContentInfo findMatch(File file) throws IOException {
		int readSize = fileReadSize;
		if (!file.exists()) {
			throw new IOException("File does not exist: " + file);
		}
		if (!file.canRead()) {
			throw new IOException("File is not readable: " + file);
		}
		long length = file.length();
		if (length <= 0) {
			return ContentInfo.EMPTY_INFO;
		}
		if (length < readSize) {
			readSize = (int) length;
		}
		byte[] bytes = new byte[readSize];
		FileInputStream fis = null;
		try {
			fis = new FileInputStream(file);
			int numRead = fis.read(bytes);
			if (numRead <= 0) {
				return ContentInfo.EMPTY_INFO;
			}
			if (numRead < bytes.length) {
				bytes = Arrays.copyOf(bytes, numRead);
			}
		} finally {
			closeQuietly(fis);
		}
		return findMatch(bytes);
	}
216632
public final void process(final File file) {
        if (file == null) {
            throw new IllegalArgumentException("Argument 'file' cannot be NULL");
        }
        if (file.isFile()) {
            handler.handleFile(file);
        } else {
            processDir(file);
        }
    }