List of usage examples for java.io FileReader FileReader
public FileReader(FileDescriptor fd)
From source file:Main.java
public static void main(String[] args) throws Exception { FileReader fileReader = new FileReader("c:/abc.txt"); System.out.println(fileReader.read()); fileReader.close();/* ww w . j a va2s.co m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { FileReader fr = new FileReader("text.txt"); int ch;// ww w . j av a 2 s . co m do { ch = fr.read(); if (ch != -1) System.out.println((char) ch); } while (ch != -1); fr.close(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { FileReader fr = new FileReader("text.txt"); int count;/*w ww. jav a 2 s. co m*/ char chrs[] = new char[80]; do { count = fr.read(chrs); for (int i = 0; i < count; i++) System.out.print(chrs[i]); } while (count != -1); }
From source file:Main.java
public static void main(String[] args) throws Exception { FileReader fileReader = new FileReader(new File("c:/abc.txt")); System.out.println(fileReader.read()); fileReader.close();/*from w w w . jav a 2 s. com*/ }
From source file:Main.java
public static void main(String args[]) throws Exception { FileReader fr = new FileReader(args[0]); BufferedReader br = new BufferedReader(fr); // Process lines from file String line;/* ww w .ja v a 2 s . com*/ while ((line = br.readLine()) != null) { char array[] = line.toCharArray(); System.out.print(array[0]); } }
From source file:Main.java
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();// w ww . j a v a 2s .c o m }
From source file:FileCopy.java
public static void main(String args[]) throws Exception { FileReader fr = new FileReader(args[0]); // Create a file writer FileWriter fw = new FileWriter(args[1]); // Read and copy characters int i;/*from w ww . j av a 2 s . com*/ while ((i = fr.read()) != -1) { fw.write(i); } fw.close(); fr.close(); }
From source file:DigitCounter.java
public static void main(String args[]) throws Exception { // Create a file reader FileReader fr = new FileReader(args[0]); // Read characters int i;//from w w w. j a va2s. co m while ((i = fr.read()) != -1) { System.out.println((char) i); } // Close file reader fr.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader("filename.txt")); String line = null;/* www . ja v a2s. c o m*/ while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader("thefile.csv")); String line = null;/*from w ww. ja v a2 s. c o m*/ while ((line = br.readLine()) != null) { String[] values = line.split(","); for (String str : values) { System.out.println(str); } } br.close(); }