java::io::FileInputStream Class Reference

Inheritance diagram for java::io::FileInputStream:

Inheritance graph
java::lang::Objectjava::lang::Interfacejava::io::InputStream
[legend]
Collaboration diagram for java::io::FileInputStream:

Collaboration graph
java::lang::Objectjava::lang::Interfacejava::lang::ObjectRefjava::io::InputStreamjava::lang::Comparable
[legend]

List of all members.


Detailed Description

A file input stream is an input stream for reading data from a File or from a FileDescriptor.

Author:
Arthur van Hoff
Version:
1.34, 07/01/98
Since:
JDK1.0

Public Member Functions

 FileInputStream (const FileDescriptor &_fd=FileDescriptor())
 Creates an input file stream to read from the specified file descriptor.
 FileInputStream (const String &name)
 Creates an input file stream to read from a file with the specified name.
 FileInputStream (const File &file)
 Creates an input file stream to read from the specified File object.
virtual jint read ()
 Reads a byte of data from this input stream.
virtual jint read (Array< jbyte > &b, jint off=0, jint len=-1)
 Reads up to len bytes of data from this input stream into an array of bytes.
virtual jlong skip (jlong n)
 Skips over and discards n bytes of data from the input stream.
virtual jint available ()
 Returns the number of bytes that can be read from this file input stream without blocking.
virtual void close ()
 Closes this file input stream and releases any system resources associated with the stream.
FileDescriptor getFD ()
 Returns the opaque file descriptor object associated with this stream.

Constructor & Destructor Documentation

java::io::FileInputStream::FileInputStream ( const FileDescriptor _fd = FileDescriptor()  ) 

Creates an input file stream to read from the specified file descriptor.

Parameters:
fdObj the file descriptor to be opened for reading.
Exceptions:
SecurityException if a security manager exists, its checkRead method is called with the file descriptor to see if the application is allowed to read from the specified file descriptor.
Since:
JDK1.0

java::io::FileInputStream::FileInputStream ( const String name  ) 

Creates an input file stream to read from a file with the specified name.

Parameters:
name the system-dependent file name.
Exceptions:
FileNotFoundException if the file is not found.
SecurityException if a security manager exists, its checkRead method is called with the name argument to see if the application is allowed read access to the file.
Since:
JDK1.0

java::io::FileInputStream::FileInputStream ( const File file  ) 

Creates an input file stream to read from the specified File object.

Parameters:
file the file to be opened for reading.
Exceptions:
FileNotFoundException if the file is not found.
SecurityException if a security manager exists, its checkRead method is called with the pathname of this File argument to see if the application is allowed read access to the file.
See also:
java.io.File::getPath()

java.lang.SecurityManager::checkRead(java.lang.String)

Since:
JDK1.0


Member Function Documentation

virtual jint java::io::FileInputStream::read (  )  [virtual]

Reads a byte of data from this input stream.

This method blocks if no input is yet available.

Returns:
the next byte of data, or -1 if the end of the file is reached.
Exceptions:
IOException if an I/O error occurs.
Since:
JDK1.0

Implements java::io::InputStream.

virtual jint java::io::FileInputStream::read ( Array< jbyte > &  b,
jint  off = 0,
jint  len = -1 
) [virtual]

Reads up to len bytes of data from this input stream into an array of bytes.

This method blocks until some input is available.

Parameters:
b the buffer into which the data is read.
off the start offset of the data.
len the maximum number of bytes read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
Exceptions:
IOException if an I/O error occurs.
Since:
JDK1.0

Implements java::io::InputStream.

virtual jlong java::io::FileInputStream::skip ( jlong  n  )  [virtual]

Skips over and discards n bytes of data from the input stream.

The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

Parameters:
n the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Exceptions:
IOException if an I/O error occurs.
Since:
JDK1.0

Implements java::io::InputStream.

virtual jint java::io::FileInputStream::available (  )  [virtual]

Returns the number of bytes that can be read from this file input stream without blocking.

Returns:
the number of bytes that can be read from this file input stream without blocking.
Exceptions:
IOException if an I/O error occurs.
Since:
JDK1.0

Reimplemented from java::io::InputStream.

virtual void java::io::FileInputStream::close (  )  [virtual]

Closes this file input stream and releases any system resources associated with the stream.

Exceptions:
IOException if an I/O error occurs.
Since:
JDK1.0

Reimplemented from java::io::InputStream.

FileDescriptor java::io::FileInputStream::getFD (  ) 

Returns the opaque file descriptor object associated with this stream.

Returns:
the file descriptor object associated with this stream.
Exceptions:
IOException if an I/O error occurs.
See also:
java.io.FileDescriptor
Since:
JDK1.0


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:30 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3