Java File convert tab characters to space characters
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; public class Main { public static void main(String args[]) throws Exception { FileReader fr = new FileReader("Main.java"); BufferedReader br = new BufferedReader(fr); FileWriter fw = new FileWriter("Main1.java"); BufferedWriter bw = new BufferedWriter(fw); // Convert tab to space characters String s;/*from www . ja v a2s. co m*/ while ((s = br.readLine()) != null) { for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\t') c = ' '; bw.write(c); } } bw.flush(); fr.close(); fw.close(); System.out.println("done"); } }