public void writeAll ( Writer writer , Collection < T > entities , boolean writeHeader ) throws IOException { checkEntityConfig ( ) ; BufferedWriter bufferedWriter = new BufferedWriter ( writer ) ; try { if ( writeHeader ) { writeHeader ( bufferedWriter , true ) ; } for ( T entity : entities ) { writeRow ( bufferedWriter , entity , true ) ; } } finally { bufferedWriter . close ( ) ; } }
Write a header and then the collection of entities to the writer .