O'Reilly logo

Special Edition Using Java 2 Standard Edition by Geoff Friesen, Chuck Cavaness, Brian Keeton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading and Writing Files

If your file-reading needs are relatively simple, you can use the FileInputStream class, which is a simple input-stream class derived from InputStream. This class features all the methods inherited from the InputStream class. To create an object of the FileInputStream class, you call one of its constructors, of which there are three, as shown:

FileInputStream(String name)
FileInputStream(File file)
FileInputStream(FileDescriptor fdObj)

The first constructor takes a String as the argument and uses this String to create a FileInputStream object. The second constructor creates the object from a File object, and the third creates the object from a FileDescriptor object.

As you might have guessed, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required