All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nerd4j.csv.writer.CSVWriterFactory Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
/*
 * #%L
 * Nerd4j CSV
 * %%
 * Copyright (C) 2013 Nerd4j
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * .
 * #L%
 */
package org.nerd4j.csv.writer;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

import org.nerd4j.csv.exception.ModelToCSVBindingException;


/**
 * Represents a Factory able to build and configure {@link CSVWriter}s.
 * 
 * @param  type of the data model accepted by the writer.
 * 
 * @author Nerd4j Team
 */
public interface CSVWriterFactory
{
    
    /**
     * Creates the {@link CSVWriter} able to write the given
     * data model into the provided CSV destination file.
     * 
     * @param file the CSV destination file.
     * @return a related {@link CSVWriter}.
     * @throws FileNotFoundException if fails to find the destination file.
     * @throws IOException if fails to write the destination file.
     * @throws ModelToCSVBindingException if binding configuration is inconsistent.
     */
    public CSVWriter getCSVWriter( File file )
    throws FileNotFoundException, IOException, ModelToCSVBindingException;
    
    /**
     * Creates the {@link CSVWriter} able to write the given
     * data model into the provided CSV destination output stream.
     * 
     * @param os the CSV destination output stream.
     * @return a related {@link CSVWriter}.
     * @throws IOException if fails to write the destination.
     * @throws ModelToCSVBindingException if binding configuration is inconsistent.
     */
    public CSVWriter getCSVWriter( OutputStream os )
    throws IOException, ModelToCSVBindingException;
    
    /**
     * Creates the {@link CSVWriter} able to write the given
     * data model of type M into the provided
     * CSV destination.
     * 
     * @param writer the CSV destination writer.
     * @return a related {@link CSVWriter}.
     * @throws IOException if fails to write the destination.
     * @throws ModelToCSVBindingException if binding configuration is inconsistent.
     */
    public CSVWriter getCSVWriter( Writer writer )
    throws IOException, ModelToCSVBindingException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy