Java FileDescriptor.valid()

Syntax

FileDescriptor.valid() has the following syntax.

public boolean valid()

Example

In the following code shows how to use FileDescriptor.valid() method.


import java.io.FileDescriptor;
import java.io.FileOutputStream;
/*from w w w  .j  a v a  2s  .  c  om*/
public class Main {
  public static void main(String[] argv) throws Exception {
    FileOutputStream os = new FileOutputStream("outfilename");
    FileDescriptor fd = os.getFD();
    os.write(1);
    os.flush();
    fd.valid();
  }
}