Java IO Tutorial - Java FileReader(FileDescriptor fd) Constructor








Syntax

FileReader(FileDescriptor fd) constructor from FileReader has the following syntax.

public FileReader(FileDescriptor fd)

Example

In the following code shows how to use FileReader.FileReader(FileDescriptor fd) constructor.

import java.io.FileOutputStream;
import java.io.FileReader;
//from  w w w .  ja va 2  s.  c om
public class Main {
  public static void main(String[] args) throws Exception {
    FileReader fileReader = new FileReader(new FileOutputStream("c:/abc.txt").getFD());
    System.out.println(fileReader.read());
    fileReader.close();
    
  }
}