FileInputStream Class
Package: java.io
The FileInputStream class connects an input stream to an input file. You won’t often use this class to read directly from an input file. Instead, you’ll use it with other classes such as BufferedInputStream and DataInputStream.
Constructors
|
Constructor |
Description |
|
|
Creates a file input stream from the specified object. It throws |
|
|
Creates a file input stream from the specified pathname. It throws |
Creating a FileInputStream object
You can create FileInputStream from a File object like this:
File f;
FileInputStream fstream;
f = new File(“myfile.txt”);
fstream = new FileInputStream(f);
If you prefer, you can skip the File object and create the FileInputStream directly from a path string:
FileInputStream fstream;
fstream = new FileInputStream(“myfile.txt”);
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access