I have a file f
and I need to affect it into a FileInputStream
fs
:
File f = new File("C:/dir/foo.txt");
FileInputStream fs = (FileInputStream)f;
But i get this error :
Cannot cast from File to FileInputStream
How can fs
get the content of f
?
The trick is this:
FileInputStream fs = new FileInputStream(f);