public final class

FileDescriptor

extends Object
java.lang.Object
   ↳ java.io.FileDescriptor

Class Overview

The lowest-level representation of a file, device, or socket. If is often used for wrapping an operating system "handle". Some I/O classes can be queried for the FileDescriptor they are operating on, and this descriptor can subsequently be used during the instantiation of another I/O class, so that the new object will reuse it.

The FileDescriptor class also contains static fields representing the system's standard input, output and error streams. These can be used directly if desired, but it is recommended to go through System.in, System.out, and System.err streams respectively.

Applications should not create new FileDescriptors.

Summary

Constants
FileDescriptor err FileDescriptor representing standard error.
FileDescriptor in The FileDescriptor representing standard input.
FileDescriptor out FileDescriptor representing standard out.
Public Constructors
FileDescriptor()
Constructs a new FileDescriptor containing an invalid handle.
Public Methods
void sync()
Ensures that data which is buffered within the underlying implementation is written out to the appropriate device before returning.
boolean valid()
Indicates whether this FileDescriptor is valid.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final FileDescriptor err

FileDescriptor representing standard error.

public static final FileDescriptor in

The FileDescriptor representing standard input.

public static final FileDescriptor out

FileDescriptor representing standard out.

Public Constructors

public FileDescriptor ()

Constructs a new FileDescriptor containing an invalid handle. The contained handle is usually modified by native code at a later point.

Public Methods

public void sync ()

Ensures that data which is buffered within the underlying implementation is written out to the appropriate device before returning.

Throws
SyncFailedException when the operation fails.

public boolean valid ()

Indicates whether this FileDescriptor is valid.

Returns
  • true if this FileDescriptor is valid, false otherwise.