FileDescriptor 

Introduction

The Java.io.FileDescriptor 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 Java.io.FileDescriptor class −

public final class FileDescriptor
   extends Object

Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.

Field

Following are the fields for Java.io.FileDescriptor 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
1FileDescriptor()This method constructs an (invalid) FileDescriptor object.

Class methods

Sr.No.Method & Description
1void sync()This method force all system buffers to synchronize with the underlying device.
2boolean valid()This method tests if this file descriptor object is valid.

Methods inherited

This class inherits methods from the following classes −

  • Java.io.Object

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *