Posts

Showing posts from February, 2013

Adding Groovy Sources to Maven Build Path

Say you want to run a groovy class method from your Java project in Maven. You've placed the script file at src/main/groovy/script/MyGroovyScriptClass.groovy . In Java, you would load the class and execute its method like so:

Ignore Header and Trailer Lines During Java InputStream Read

Ignore first + last lines in a file After beating my head against the wall for some time, I was finally able to come up with a solution for this. Say you want to hand off an InputStream or InputStreamReader to an underlying API. The problem is that your input stream may have a header or trailer. Those header/trailers differ from the underlying format. This is commonly true for CSV, EDI, and fixed length file types. So if you want a CSV file parsed by a Java API like the Smooks api, you will need to hand the framework an InputStream.