Here you can find the source of readFile(String filePath)
Parameter | Description |
---|---|
filePath | - Path of the file whose input stream is desired |
Parameter | Description |
---|---|
FileNotFoundException | the file not found exception |
public static InputStream readFile(String filePath) throws FileNotFoundException
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; public class Main { /**/* www.j a v a 2 s. com*/ * This method reads a file at specfied path and returns its inputStream. * * @param filePath - Path of the file whose input stream is desired * @return InputStream of the file * @throws FileNotFoundException the file not found exception */ public static InputStream readFile(String filePath) throws FileNotFoundException { File file = new File(filePath); return new FileInputStream(file); } }