22.4
java.io.FileInputStream
THE PACKAGE JAVA.IO
22.4 The Class
java.io.FileInputStream
A file input stream obtains input bytes from a file in a file system. What files are
available depends on the host environment.
public class FileInputStream extends InputStream {
public FileInputStream(String path)
throws SecurityException, FileNotFoundException;
public FileInputStream(File file)
throws SecurityException, FileNotFoundException;
public FileInputStream(FileDescriptor fdObj)
throws SecurityException;
public native int read() throws IOException;
public int read(byte[] b)
throws IOException, NullPointerException;
public int read(byte[] b, int off, int len)
throws IOException, NullPointerException,
IndexOutOfBoundsException;
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;
protected void finalize() throws IOException;
}
22.4.1
public FileInputStream(String path)
throws SecurityException, FileNotFoundException
This constructor initializes a newly created
FileInputStream
by opening a con
nection to an actual file, the file named by the path name
path
in the file system.
A new
FileDescriptor
object is created to represent this file connection.
First, if there is a security manager, its
checkRead
method ( 20.17.19) is
called with the
path
argument as its argument.
If the actual file cannot be opened, a
FileNotFoundException
is thrown.
22.4.2
public FileInputStream(File file)
throws SecurityException, FileNotFoundException
This constructor initializes a newly created
FileInputStream
by opening a con
nection to an actual file, the file named by the
File
object
file
in the file system.
A new
FileDescriptor
object is created to represent this file connection.
684
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved