Returns an input stream from a {@code File} object.

@param file
a {@code File} object representing the input file; the file must be
existing and readable.
@return
a {@code FileInputStream} object.
@throws FileNotFoundException
8810
public static InputStream fromFile(File file) throws FileNotFoundException {
		if(file != null && file.isFile() && file.canRead()) {
			return new FileInputStream(file);
		}
		return null;
	}
519048
public static Properties fromFile(
    final File file)
    throws IOException
  {
    Objects.requireNonNull(file, "File");

    try (InputStream stream = Files.newInputStream(file.toPath())) {
      final Properties p = new Properties();
      p.load(stream);
      return p;
    }
  }
845513
public static String readFile(InputStream file) {
        try (BufferedInputStream stream = new BufferedInputStream(file)) {
            byte[] buff = new byte[1024];
            StringBuilder builder = new StringBuilder();
            int read;
            while ((read = stream.read(buff)) != -1) {
                builder.append(new String(buff, 0, read, StandardCharsets.UTF_8));
            }
            return builder.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
699823
@SuppressWarnings("resource")
    public InputStream getInputStream(String filename)
    {
        InputStream streamIn = null;
        if (filename.indexOf(':') == -1)
        {
            String filepath = ((BaseHttpTask)this.getTask()).getRealPath(this.getServletRequest(), filename);
            if (filepath != null)
            {
	            File file = new File(filepath);
	            try   {
	                streamIn = new FileInputStream(file);
	            } catch (FileNotFoundException ex)  {
	                streamIn = null;
	            }
            }
        }
        if (streamIn == null)
            streamIn = Utility.getInputStream(filename, this.getApplication());
        return streamIn;
    }
437943
public InputStream getInputStream()
    throws IOException
  {
    if (_is == null)
      _is = new FileInputStream(_file.getFD());

    return _is;
  }
888668
public String readFileContent(File file) {
        StringBuilder fileContentBuilder = new StringBuilder();
        if (file.exists()) {
            String stringLine;
            try {
                FileReader fileReader = new FileReader(file);
                BufferedReader bufferedReader = new BufferedReader(fileReader);
                while ((stringLine = bufferedReader.readLine()) != null) {
                    fileContentBuilder.append(stringLine + "\n");
                }
                bufferedReader.close();
                fileReader.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        return fileContentBuilder.toString();
    }
1227555
private InputStream openFile() throws IOException {
    Path file = Paths.get(filePath);
    if (Files.exists(file)) {
      return Files.newInputStream(file);
    }
    InputStream input = getClass().getResourceAsStream(filePath);
    checkArgument(input != null, "Could not find file: " + filePath);
    return input;
  }
563620
public static Sink sink(File file) throws FileNotFoundException {
    if (file == null) throw new IllegalArgumentException("file == null");
    return sink(new FileOutputStream(file));
  }
319618
public InputStreamReader getFileStream(String filename, String encoding)
			throws NoSuchPathException, UnmarshalException{
		try {
			return new InputStreamReader(new FileInputStream(filename), encoding);
		} catch (FileNotFoundException e) {
			throw new NoSuchPathException(e);
		} catch (UnsupportedEncodingException e){
			throw new UnmarshalException(e);
		}
	}
113594
public static void toFile(InputStream input, File file) throws IOException {
		OutputStream os = new FileOutputStream(file);
		int bytesRead = 0;
		byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
		while ((bytesRead = input.read(buffer, 0, DEFAULT_BUFFER_SIZE)) != -1) {
			os.write(buffer, 0, bytesRead);
		}
		IOUtils.closeQuietly(os);
		IOUtils.closeQuietly(input);
	}
1352447
public static byte[] readFileAtOnce(final File file) throws IOException {
		final FileInputStream fIn = new FileInputStream(file);
		return readFileAtOnce(fIn);
	}
459497
public static InputStream openFile(File file) throws RuntimeIOException {
    try {
      InputStream is = new BufferedInputStream(new FileInputStream(file));
      if (file.getName().endsWith(".gz")) {
        is = new GZIPInputStream(is);
      }
      return is;
    } catch (Exception e) {
      throw new RuntimeIOException(e);
    }
  }
1189732
private InputStream getInputFromJarOrTemp() throws FileNotFoundException
    {
        final InputStream input = loader.get().getResourceAsStream(UtilFolder.getPathSeparator(separator, getPath()));
        if (input == null)
        {
            return new FileInputStream(getPathTemp());
        }
        return input;
    }
712438
public static byte[] fileBytes(File file) throws IOException {

		FileInputStream fis = new FileInputStream(file);

		return streamBytes(fis);
	}
76454
public static void copy(InputStream is, File file) throws IOException {

		Asserts.notNullParameter("is", is);
		Asserts.notNullParameter("file", file);
		
		FileOutputStream os = null;
		os = new FileOutputStream(file);
		copy(is, os);
	}
919765
public Engine fromFile(File file) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                new FileInputStream(file), FuzzyLite.UTF_8));
        String line;
        StringBuilder textEngine = new StringBuilder();
        try {
            while ((line = reader.readLine()) != null) {
                textEngine.append(line).append("\n");
            }
        } catch (IOException ex) {
            throw ex;
        } finally {
            reader.close();
        }
        return fromString(textEngine.toString());
    }
1181977
public Configurator fromFile(File file) {
        if (!file.exists()) throw new FileNotFoundException(file.getAbsolutePath() + "does not exist.");
        return new Configurator(Uri.fromFile(file));
    }