import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class InputStreamReaderExample {
public static void main(String[] args) {
InputStream inputStream=null;
Reader reader=null;
try {
inputStream = new FileInputStream("d:/ram.txt");
reader = new InputStreamReader(inputStream);
int data = reader.read();
while(data != -1){
char out = (char) data;
System.out.print(out);
data = reader.read();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finally {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}