title: Need to transform file faster
body: <p>I have a text file contains the data which contains some special characters like 'SOH' or 'STX' and ASCII value 13 and 10. I need to remove these characters and replace it with '\n'. </p>
  
  <p>Right now I am taking each character at a time and replace the corresponding characters. The problem is my file size is in GB and it is reading each character at a time and do the operation.</p>
  
  <p>This process takes a lot of time to complete. If I try to increase the character reading by more than 1, it gives me bad structure of file data.</p>
  
  <p>I need a help in this to make this process faster or some other technique to transform these files.</p>
  
  <pre><code>char[] chars = new char[1];
  for(int len; (len = reader.read(chars)) &gt; 0;) {
    String head = new String(chars);
    fw.write(head.replaceAll(String.valueOf((char)13),"").replaceAll(String.valueOf((char)10), "").replaceAll(String.valueOf((char)2), "\n"));
  }
  </code></pre>