![JAR search and dependency download from the Maven repository](/logo.png)
net.sf.flatpack.writer.AbstractWriterFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flatpack Show documentation
Show all versions of flatpack Show documentation
Simple Java delimited and fixed width file parser. Handles CSV, Excel CSV, Tab, Pipe delimiters, just to name a few.
Maps column positions in the file to user friendly names via XML. See FlatPack Feature List under News for complete feature list.
package net.sf.flatpack.writer;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import net.sf.flatpack.InitialisationException;
import net.sf.flatpack.util.FPConstants;
import net.sf.flatpack.xml.MapParser;
import org.jdom.JDOMException;
/**
*
* @author Dirk Holmes and Holger Holger Hoffstatte
*/
public abstract class AbstractWriterFactory extends Object implements WriterFactory {
private Map mapping;
protected AbstractWriterFactory() {
super();
mapping = new HashMap();
mapping.put(FPConstants.DETAIL_ID, new ArrayList());
mapping.put(FPConstants.COL_IDX, new HashMap());
}
protected AbstractWriterFactory(final Map mapping) {
super();
this.mapping = mapping;
}
protected AbstractWriterFactory(final Reader mappingSrc) throws IOException {
this();
try {
mapping = MapParser.parse(mappingSrc, null);
} catch (final JDOMException jde) {
throw new InitialisationException(jde);
}
}
protected Map getColumnMapping() {
// TODO DO: return deep mutable clone here or better: make the Map a first class
// citizen of the library
return Collections.unmodifiableMap(mapping);
}
public abstract Writer createWriter(java.io.Writer out) throws IOException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy