- Java.io - Writer
- Java.io - StringWriter
- Java.io - StringReader
- Java.io - StringBufferInputStream
- Java.io - StreamTokenizer
- Java.io - SerializablePermission
- Java.io - SequenceInputStream
- Java.io - Reader
- Java.io - RandomAccessFile
- Java.io - PushbackReader
- Java.io - PushbackInputStream
- Java.io - PrintWriter
- Java.io - PrintStream
- Java.io - PipedWriter
- Java.io - PipedReader
- Java.io - PipedOutputStream
- Java.io - PipedInputStream
- Java.io - OutputStreamWriter
- Java.io - OutputStream
- Java.io - ObjectStreamField
- Java.io - ObjectStreamClass
- io - ObjectOutputStream.PutField
- Java.io - ObjectOutputStream
- Java.io - ObjectInputStream.GetField
- Java.io - ObjectInputStream
- Java.io - LineNumberReader
- Java.io - LineNumberInputStream
- Java.io - InputStreamReader
- Java.io - InputStream
- Java.io - FilterWriter
- Java.io - FilterReader
- Java.io - FilterOutputStream
- Java.io - FilterInputStream
- Java.io - FileWriter
- Java.io - FileReader
- Java.io - FilePermission
- Java.io - FileOutputStream
- Java.io - FileInputStream
- Java.io - FileDescriptor
- Java.io - File
- Java.io - DataOutputStream
- Java.io - DataInputStream
- Java.io - Console
- Java.io - CharArrayWriter
- Java.io - CharArrayReader
- Java.io - ByteArrayOutputStream
- Java.io - ByteArrayInputStream
- Java.io - BufferedWriter
- Java.io - BufferedReader
- Java.io - BufferedOutputStream
- Java.io - BufferedInputStream
- Java.io - Home
Java.io package extras
Java.io package Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.io.FileInputStream Class
Introduction
The Java.io.FileInputStream class obtains input bytes from a file in a file system. What files are available depends on the host environment. Following are the important points about FileInputStream −
This class is meant for reading streams of raw bytes such as image data.
For reading streams of characters, use FileReader.
Class declaration
Following is the declaration for Java.io.FileInputStream class −
pubpc class FileInputStream extends InputStream
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 | FileInputStream(File file) This creates a FileInputStream by opening a connection to an actual file, the file named by the File object file in the file system. |
2 | FileInputStream(FileDescriptor fdObj) This creates a FileInputStream by using the file descriptor fdObj, which represents an existing connection to an actual file in the file system. |
3 | FileInputStream(String name) This creates a FileInputStream by opening a connection to an actual file, the file named by the path name name in the file system. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method returns an estimate of the number of remaining bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream. |
2 | This method closes this file input stream and releases any system resources associated with the stream. |
3 | This method ensures that the close method of this file input stream is called when there are no more references to it. |
4 | This method returns the unique FileChannel object associated with this file input stream. |
5 | This method returns the FileDescriptor object that represents the connection to the actual file in the file system being used by this FileInputStream. |
6 | This method reads a byte of data from this input stream. |
7 | This method reads up to b.length bytes of data from this input stream into an array of bytes. |
8 | This method reads up to len bytes of data from this input stream into an array of bytes. |
9 | This method skips over and discards n bytes of data from the input stream. |
Methods inherited
This class inherits methods from the following classes −
Java.io.InputStream
Java.io.Object