public class Exporter<O> extends Object
To create a new exporter, you need to use an ExporterBuilder.
There is some useful methods such as of(ExporterConfiguration) or of(ExportModel) to
obtain directly an exporter from a legacy export model or a exporter configuration.
There is also other method to create a new export builder such as builder(), builder(ExporterConfiguration) or
builder(ExportModel). Once this is done, use the ExporterBuilder API.
exportTo...(...) methods.
You can export to
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Exporter.ExporterAction<E> |
| Modifier and Type | Field and Description |
|---|---|
protected ExporterConfiguration<O> |
configuration
Immutable exporter configuration.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Exporter(ExporterConfiguration<O> configuration) |
| Modifier and Type | Method and Description |
|---|---|
static <O> ExporterBuilder<O> |
builder()
Creates a new empty exporter builder.
|
static <O> ExporterBuilder<O> |
builder(ExporterConfiguration<O> configuration)
Creates a new exporter builder from the given configuration.
|
static <O> ExporterBuilder<O> |
builder(ExportModel<O> model)
Creates a new exporter builder from the given model.
|
static <O> Exporter<O> |
of(ExporterConfiguration<O> configuration)
Creates an exporter from the given configuration.
|
static <O> Exporter<O> |
of(ExportModel<O> model)
Creates an exporter from the given model, and using default configuration values.
|
ExporterBuilder<O> |
toBuilder()
Creates a new exporter builder from this exporter (to reuse his configuration).
|
void |
toFile(Iterable<O> data,
boolean writeHeader,
File file)
Produces the cvs of the given
data into the given file. |
void |
toFile(Iterable<O> data,
File file)
Produces the cvs of the given
data into the given file. |
void |
toFileWithoutHeader(Iterable<O> data,
File file)
Produces the cvs (without header) of the given
data into the given file. |
InputStream |
toInputStream(Iterable<O> data)
Produces the cvs of the given
data and returns it as a InputStream. |
InputStream |
toInputStream(Iterable<O> data,
boolean writeHeader)
Produces the cvs (without header) of the given
data and returns it as a InputStream. |
InputStream |
toInputStreamWithoutHeader(Iterable<O> data)
Produces the cvs (without header) of the given
data and returns it as a InputStream. |
void |
toOutputStream(Iterable<O> data,
boolean writeHeader,
OutputStream outputStream)
Produces the cvs of the given
data into the given outputStream. |
void |
toOutputStream(Iterable<O> data,
OutputStream outputStream)
Produces the cvs of the given
data into the given outputStream. |
void |
toOutputStreamWithoutHeader(Iterable<O> data,
OutputStream outputStream)
Produces the cvs (without header) of the given
data into the given outputStream. |
Reader |
toReader(Iterable<O> data)
Produces the cvs of the given
data and returns it as a Reader. |
Reader |
toReader(Iterable<O> data,
boolean writeHeader)
Produces the cvs (without header) of the given
data and returns it as a Reader. |
Reader |
toReaderWithoutHeader(Iterable<O> data)
Produces the cvs (without header) of the given
data and returns it as a Reader. |
String |
toString(Iterable<O> data)
Produces the cvs of the given
data and returns it as a String. |
String |
toString(Iterable<O> data,
boolean writeHeader)
Produces the cvs of the given
data and returns it as a String. |
String |
toStringWithoutHeader(Iterable<O> data)
Produces the cvs (without header) of the given
data and returns it as a String. |
void |
toWriter(Iterable<O> data,
boolean writeHeader,
Writer writer)
Produces the cvs of the given
data into the given writer. |
void |
toWriter(Iterable<O> data,
Writer writer)
Produces the cvs of the given
data into the given writer. |
void |
toWriterWithoutHeader(Iterable<O> data,
Writer writer)
Produces the cvs (without header) of the given
data into the given writer. |
protected final ExporterConfiguration<O> configuration
protected Exporter(ExporterConfiguration<O> configuration)
public static <O> Exporter<O> of(ExportModel<O> model)
O - type of data to exportmodel - model of exportpublic static <O> Exporter<O> of(ExporterConfiguration<O> configuration)
O - type of data to exportconfiguration - export configurationpublic static <O> ExporterBuilder<O> builder(ExportModel<O> model)
O - type of data to exportmodel - model of exportpublic static <O> ExporterBuilder<O> builder(ExporterConfiguration<O> configuration)
O - type of data to exportconfiguration - configuration of exportpublic static <O> ExporterBuilder<O> builder()
public void toOutputStream(Iterable<O> data, OutputStream outputStream) throws IOException
data into the given outputStream.data - data to exportoutputStream - where to perform the exportIOExceptionpublic void toOutputStreamWithoutHeader(Iterable<O> data, OutputStream outputStream) throws IOException
data into the given outputStream.data - data to exportoutputStream - where to perform the exportIOExceptionpublic void toOutputStream(Iterable<O> data, boolean writeHeader, OutputStream outputStream) throws IOException
data into the given outputStream.data - data to exportwriteHeader - write or not header (first line of the export)outputStream - where to perform the exportIOExceptionpublic void toWriter(Iterable<O> data, Writer writer) throws IOException
data into the given writer.data - data to exportwriter - where to perform the exportIOExceptionpublic void toWriterWithoutHeader(Iterable<O> data, Writer writer) throws IOException
data into the given writer.data - data to exportwriter - where to perform the exportIOExceptionpublic void toWriter(Iterable<O> data, boolean writeHeader, Writer writer) throws IOException
data into the given writer.data - data to exportwriteHeader - write or not header (first line of the export)writer - where to perform the exportIOExceptionpublic void toFile(Iterable<O> data, File file) throws IOException
data into the given file.data - data to exportfile - where to perform the exportIOExceptionpublic void toFileWithoutHeader(Iterable<O> data, File file) throws IOException
data into the given file.data - data to exportfile - where to perform the exportIOExceptionpublic void toFile(Iterable<O> data, boolean writeHeader, File file) throws IOException
data into the given file.data - data to exportwriteHeader - write or not header (first line of the export)file - where to perform the exportIOExceptionpublic String toString(Iterable<O> data) throws IOException
data and returns it as a String.data - data to exportIOExceptionpublic String toStringWithoutHeader(Iterable<O> data) throws IOException
data and returns it as a String.data - data to exportIOExceptionpublic String toString(Iterable<O> data, boolean writeHeader) throws IOException
data and returns it as a String.data - data to exportwriteHeader - write or not header (first line of the export)IOExceptionpublic Reader toReader(Iterable<O> data) throws IOException
data and returns it as a Reader.data - data to exportIOExceptionpublic Reader toReaderWithoutHeader(Iterable<O> data) throws IOException
data and returns it as a Reader.data - data to exportIOExceptionpublic Reader toReader(Iterable<O> data, boolean writeHeader) throws IOException
data and returns it as a Reader.data - data to exportwriteHeader - write or not header (first line of the export)IOExceptionpublic InputStream toInputStream(Iterable<O> data) throws IOException
data and returns it as a InputStream.data - data to exportIOExceptionpublic InputStream toInputStreamWithoutHeader(Iterable<O> data) throws IOException
data and returns it as a InputStream.data - data to exportIOExceptionpublic InputStream toInputStream(Iterable<O> data, boolean writeHeader) throws IOException
data and returns it as a InputStream.data - data to exportIOExceptionpublic ExporterBuilder<O> toBuilder()
Copyright © 2013–2022 Code Lutin. All rights reserved.