org.nuiton.util.csv
Class Export<E>

java.lang.Object
  extended by org.nuiton.util.csv.Export<E>

public class Export<E>
extends Object

Object to realize a export from a ExportModel and some datas.

Usefull static methods

There is some usefull methods here to do operation in one line :

To export to a file

     Export.exportToFile(model, data, file);
 

To export to a writer

     Export.exportToWriter(model, data, writer);
 

To export as a string

     String exportcontent = Export.exportToString(model, data);
 

To obtain a new instance of an exporter

     Export<E> exporter = Export.newExport(model, data);
 

Since:
2.4
Author:
bleny , tchemit

Field Summary
protected  Iterable<E> data
           
protected  ExportModel<E> model
           
 
Constructor Summary
protected Export(ExportModel<E> model, Iterable<E> data)
           
 
Method Summary
static
<E> void
exportToFile(ExportModel<E> model, Iterable<E> data, File file)
           
 void exportToFile(File file)
           
static
<E> String
exportToString(ExportModel<E> model, Iterable<E> data)
           
static
<E> void
exportToWriter(ExportModel<E> model, Iterable<E> data, Writer writer)
           
static
<E> Export<E>
newExport(ExportModel<E> model, Iterable<E> data)
           
 InputStream startExport()
           
 void startExport(Writer writer)
           
 String startExportAsString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected ExportModel<E> model

data

protected Iterable<E> data
Constructor Detail

Export

protected Export(ExportModel<E> model,
                 Iterable<E> data)
Method Detail

newExport

public static <E> Export<E> newExport(ExportModel<E> model,
                                      Iterable<E> data)

exportToFile

public static <E> void exportToFile(ExportModel<E> model,
                                    Iterable<E> data,
                                    File file)
                         throws Exception
Throws:
Exception

exportToString

public static <E> String exportToString(ExportModel<E> model,
                                        Iterable<E> data)
                             throws Exception
Throws:
Exception

exportToWriter

public static <E> void exportToWriter(ExportModel<E> model,
                                      Iterable<E> data,
                                      Writer writer)
                           throws Exception
Throws:
Exception

exportToFile

public void exportToFile(File file)
                  throws Exception
Throws:
Exception

startExport

public void startExport(Writer writer)
                 throws Exception
Throws:
Exception

startExportAsString

public String startExportAsString()
                           throws Exception
Throws:
Exception

startExport

public InputStream startExport()
                        throws Exception
Throws:
Exception


Copyright © 2011-2012 CodeLutin. All Rights Reserved.