
net.sf.jtables.io.WriterTableObjectToRowsAbstract Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtables Show documentation
Show all versions of jtables Show documentation
Simple and lightweight framework to work with tables and table based files such as CSV and other (tab)-delimited files.
package net.sf.jtables.io;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
public abstract class WriterTableObjectToRowsAbstract extends WriterTableString {
public WriterTableObjectToRowsAbstract(File file) throws IOException {
super(file);
}
public WriterTableObjectToRowsAbstract(OutputStream stream) {
super(stream);
}
public WriterTableObjectToRowsAbstract(Writer writer) {
super(writer);
}
public WriterTableObjectToRowsAbstract writeElement(T element) throws IOException {
writeElement(DEFAULT_DELIMITER, element);
return this;
}
public WriterTableObjectToRowsAbstract writeElements(Collection extends T> elements) throws IOException {
writeElements(DEFAULT_DELIMITER, elements);
return this;
}
public WriterTableObjectToRowsAbstract writeElements(String delimiter, Collection extends T> elements) throws IOException {
Iterator extends T> it = elements.iterator();
while(it.hasNext()){
writeElement(delimiter, it.next());
if(it.hasNext()){
super.writer.newLine();
}
}
return this;
}
public abstract WriterTableObjectToRowsAbstract writeElement(String delimiter, T element) throws IOException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy