title: Apache Camel File Splitter by Example
body: <p>I'm being given a file containing numeric IDs that are delimited by newlines ("<code>\n</code>"):</p>
  
  <pre><code>123948
  939904
  129384
  234049
  </code></pre>
  
  <p>etc. I want to use Camel to transform the file into an instance of the following POJO:</p>
  
  <pre><code>public class IDFile {
      private String fileName;    // The name of the file
      private List&lt;Long&gt; ids;     // All the IDs in the file (123948, 939904, etc.)
  
      // Constructor, getters/setters, etc.
  }
  </code></pre>
  
  <p>I'm trying to see if I can use Camel's <a href="http://camel.apache.org/splitter.html" rel="nofollow noreferrer">Splitter</a> component to do this form me, but it feels like I'm trying to force a round peg into a square hole:</p>
  
  <pre><code>&lt;route&gt;
      &lt;from uri="file://input/idfile"/&gt;
      &lt;split streaming="true"&gt;
          &lt;tokenize token="\n" /&gt;
          &lt;to uri="bean://idfileProcessor?method=process"/&gt;
      &lt;/split&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>The above looks like it would split my file into a <code>List&lt;Long&gt;</code>, but I need the file name associated with the list as well. Any ideas?</p>