![]() |
VOOZH | about |
Java.io.FileInputStream.getFD() method is a part of Java.io.FileInputStream class. This method will return the FileDescriptor object associated with the file input stream.
Syntax:
public final FileDescriptor getFD() throws IOException
Return Type: getFD() method will return the instance of FileDescriptor associated with this FileInputStream.
Exception: getFD() method might throw IOException if any Input/output exception raises.
Step 1: First, we have to create an instance of Java.io.FileInputStream class
FileInputStream fileInputStream =new FileInputStream("tmp.txt");
Step 2: To get the instance of FileDescriptor associated with this fileInputStream, we will invoke the getFD() method
FileDescriptor fileDescriptor =fileInputStream.getFD();
In the below program, we will
Output:
Is FileDescriptor valid : true
Note: The programs will run on an online IDE. Please use an offline IDE and change the Name of the file according to your need.