Reading Files

The FileInputStream class represents an InputStream that reads bytes from a file. It has the following public methods:

 public FileInputStream(String filename) throws FileNotFoundException
 public FileInputStream(File file) throws FileNotFoundException
 public FileInputStream(FileDescriptor fdObj)
 public native int read() throws IOException
 public int read(byte[] data) throws IOException
 public int read(byte[] data, int offset, int length) throws IOException
 public native long skip(long n) throws IOException
 public native int available() throws IOException
 public native void close() throws IOException
 public final FileDescriptor getFD() throws IOException
Except for the constructors and getFD(), these methods merely override the methods of the same name in You use them exactly like you use those methods, only you'll end up reading data from a file.
Copyright 2000 Elliotte Rusty Harold
Last Modified January 28, 2000