getFD(): This method is available in the java.io.FileOutputStream class of Java.
Syntax:
FileDescriptor java.io.FileOutputStream.getFD() throws IOException
This method returns the file descriptor associated with this stream.
Parameters: NA
Returns: the FileDescriptor object that represents the connection to the file in the file system being used by this FileOutputStream object.
Throws:
IOException - if an I/O error occurs.
Approach
Java
import java.io.File;import java.io.FileOutputStream;import java.io.IOException;public class FileOutputStreamgetFD {public static void main(String[] args) throws IOException {String pathname = "D:\\hello.txt";File file = new File(pathname);FileOutputStream fileOutputStream =new FileOutputStream(file);System.out.println(fileOutputStream.getFD());fileOutputStream.close();}}
Output:
java.io.FileDescriptor@182decdb
No comments:
Post a Comment