com.orion.office.csv.reader.CsvRawReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of orion-office Show documentation
Show all versions of orion-office Show documentation
orion office (excel csv and more...)
package com.orion.office.csv.reader;
import com.orion.lang.utils.Strings;
import com.orion.office.csv.core.CsvReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Consumer;
/**
* csv raw 读取器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2021/2/7 16:15
*/
public class CsvRawReader extends BaseCsvReader {
/**
* 行默认值
*/
private String defaultRaw;
public CsvRawReader(CsvReader reader) {
this(reader, new ArrayList<>(), null);
}
public CsvRawReader(CsvReader reader, Collection rows) {
this(reader, rows, null);
}
public CsvRawReader(CsvReader reader, Consumer consumer) {
this(reader, null, consumer);
}
protected CsvRawReader(CsvReader reader, Collection rows, Consumer consumer) {
super(reader, rows, consumer);
reader.getOption().setSkipRawRow(false);
}
/**
* 空行默认行 为 ""
*
* @return this
*/
public CsvRawReader defaultRawOfEmpty() {
this.defaultRaw = Strings.EMPTY;
return this;
}
/**
* 空行默认行
*
* @param defaultRaw 默认行
* @return this
*/
public CsvRawReader defaultRaw(String defaultRaw) {
this.defaultRaw = defaultRaw;
return this;
}
@Override
protected String parserRow(String[] row) {
return Strings.def(super.getRaw(), defaultRaw);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy