title: Best way to convert the content of a big file?
body: <p>I am learning camel and while trying out examples for file transformation (comma separated to colon separated), I came across the following example:</p>
  <p><strong>Note</strong>: The entire code is available at following location: <a href="https://github.com/dilipsundarraj1/TeachApacheCamel/blob/master/learncamel-transform" rel="nofollow noreferrer">https://github.com/dilipsundarraj1/TeachApacheCamel/blob/master/learncamel-transform</a></p>
  <pre><code>public class CamelModifyFileProcessorRoute extends RouteBuilder {
      public void configure() throws Exception {
          from(&quot;file:data/input?noop=true&quot;)
                  .process(new CamelFileExampleProcessor())
                  .log(&quot;Received Message is ${body} and Headers are ${headers}&quot;)
                  .to(&quot;file:data/output?fileName=output.txt&quot;);
      }
  }
  </code></pre>
  <p><strong>CamelFileExampleProcessor</strong></p>
  <p>In the following code, the file is being transformed in-memory.</p>
  <pre><code>public class CamelFileExampleProcessor implements org.apache.camel.Processor {
  
      String newValue=&quot;&quot;;
      private String readLine;
  
      public void process(Exchange exchange) throws Exception {
  
          GenericFile&lt;File&gt; file = (GenericFile) exchange.getIn().getBody();
          String readLine=null;
  
          if(file!=null){
  
              FileReader file1 = new FileReader(file.getFile());
              BufferedReader reader = new BufferedReader(file1);
  
              while((readLine =reader.readLine()) !=null){
                  System.out.println(&quot;Read line is : &quot; + readLine);
  
                  String oldValue = readLine;
  
                  System.out.println(&quot;Old Value is : &quot; + oldValue);
  
                  newValue = newValue.concat(oldValue.replace(&quot;,&quot;, &quot;:&quot;)).concat(&quot;\n&quot;);
  
                  System.out.println(&quot;New Value is :  &quot; + newValue);
  
                  exchange.getIn().setBody(newValue);
              }
  
          }
  
      }
  }
  </code></pre>
  <p><strong>Question</strong>: In case the file size is very big, is this a good approach to follow or are there better alternatives?</p>