Java FileInputStream (FileDescriptor fdObj) Constructor
Syntax
FileInputStream(FileDescriptor fdObj) constructor from FileInputStream has the following syntax.
public FileInputStream(FileDescriptor fdObj)
Example
In the following code shows how to use FileInputStream.FileInputStream(FileDescriptor fdObj) constructor.
/*from w ww . j a v a 2s . com*/
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(FileDescriptor.in);
// skip bytes from file input stream
fis.skip(4);
// read bytes from this stream
int i = fis.read();
// converts integer to character
char c = (char) i;
System.out.print("Character read: " + c);
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »