How to convert FileInputStream to InputStream?
InputStream is;
try {
is = new FileInputStream("c://filename");
is.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return is;
InputStream is = new FileInputStream("c://filename");
return is;
FileInputStream is an inputStream.
FileInputStream fis = new FileInputStream("c://filename");
InputStream is = fis;
fis.close();
return is;
Of course, this will not do what you want it to do; the stream you return has already been closed. Just return the FileInputStream and be done with it. The calling code should close it.