Saturday, 13 May 2017

What is FileInputStream Class In Java ?

Class FileInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

Declaration of FileInputStream:
public class FileInputStream
extends InputStream

A FileInputStream obtains input bytes from a file in a file system. What files are available depends on the host environment.

FileInputStream is meant for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader.

Constructor Summary of FileInputStream:

Constructor
Description
FileInputStream(File file)
Creates a FileInputStream by opening a connection to an actual file, the file named by the File object file in the file system.
FileInputStream(FileDescriptor fdObj)
Creates a FileInputStream by using the file descriptor fdObj, which represents an existing connection to an actual file in the file system.
FileInputStream(String name)
Creates a FileInputStream by opening a connection to an actual file, the file named by the path name name in the file system.

Method Summary of FileInputStream:

Modifier
Method Name
Description
int
available()
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.
void
close()
Closes this file input stream and releases any system resources associated with the stream.
protected void
finalize()
Ensures that the close method of this file input stream is called when there are no more references to it.
FileChannel
getChannel()
Returns the unique FileChannel object associated with this file input stream.
FileDescriptor
getFD()
Returns the FileDescriptor object that represents the connection to the actual file in the file system being used by this FileInputStream.
int
read()
Reads a byte of data from this input stream.
int
read(byte[] b)
Reads up to b.length bytes of data from this input stream into an array of bytes.
int
read(byte[] b, int off, int len)
Reads up to len bytes of data from this input stream into an array of bytes.
long
skip(long n)
Skips over and discards n bytes of data from the input stream.


      
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.

No comments:

Post a Comment