Java IO Tutorial - 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;
//www  .j  a v  a 2s. c o m
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();
  }
}