The class instances serve as an opaque handle to the underlying machine-specific structure representing an open file, an open socket, or another source or sink of bytes. Following are the important points about FileDescriptor −

  • The main practical use for a file descriptor is to create a FileInputStream or FileOutputStream to contain it.

  • Applications should not create their own file descriptors.

Class declaration

Following is the declaration for class −

public final class FileDescriptor
   extends Object


Following are the fields for class −

  • static FileDescriptor err − This is the handle to the standard error stream.

  • static FileDescriptor in − This is the handle to the standard input stream.

  • static FileDescriptor out − This is the handle to the standard output stream.

Class constructors

Sr.No. Constructor & Description


This method constructs an (invalid) FileDescriptor object.

Class methods

Sr.No. Method & Description
1 void sync()

This method force all system buffers to synchronize with the underlying device.

2 boolean valid()

This method tests if this file descriptor object is valid.

Methods inherited

This class inherits methods from the following classes −