Java FileInputStream.getFD()
Syntax
FileInputStream.getFD() has the following syntax.
public final FileDescriptor getFD() throws IOException
Example
In the following code shows how to use FileInputStream.getFD() method.
/*from ww w .j av a 2s .c o m*/
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("C://test.txt");
// get file descriptor
FileDescriptor fd = fis.getFD();
// tests if the file is valid
boolean bool = fd.valid();
System.out.println("Valid file: " + bool);
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »