FileInputStream class methods in Java

java.io.FileInputStream

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.

Some methods of FileInputStream class

available()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.

close(): This method closes this file input stream and releases any system resources associated with the stream.

getChannel()This method returns the unique FileChannel object associated with this file input stream.

getFD()This method returns the FileDescriptor object that represents the connection to the actual file in the file system being used by this FileInputStream.

read()This method reads a byte of data from this input stream. This method blocks if no input is yet available.

read(byte[])This method reads up to b.length bytes of data from this input stream into an array of bytes.

read(byte[], int, int)This method reads up to len bytes of data from this input stream into an array of bytes.

skip(long)This method skips over and discards n bytes of data from the input stream.


No comments:

Post a Comment