Input from Files

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

 public FileInputStream(String name) throws FileNotFoundException
 public FileInputStream(File file) throws FileNotFoundException
 public FileInputStream(FileDescriptor fd)
 
 public int  read() throws IOException
 public int  read(byte[] data) throws IOException
 public int  read(byte[] data, int offset, int length) 
  throws IOException
 public long skip(long n) throws IOException
 public int  available() throws IOException
 public 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 java.io.InputStream. You use them exactly like you use those methods, only you'll end up reading data from a file.


Previous | Next | Top | Cafe au Lait

Copyright 1997, 1999, 2002, 2003 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified April 22, 2003