public abstract class BaseCsvWriter<K,V> extends Object implements SafeCloseable, SafeFlushable
Modifier and Type | Field and Description |
---|---|
protected int |
capacity
数组容量
|
protected Map<K,Object> |
defaultValue
默认值
|
protected Map<Integer,K> |
mapping
映射
key: column
value: valueKey
|
protected int |
maxColumnIndex
映射最大列索引
|
protected boolean |
skipNullRows
是否跳过空行
|
protected CsvWriter |
writer
writer
|
Constructor and Description |
---|
BaseCsvWriter(CsvWriter writer) |
Modifier and Type | Method and Description |
---|---|
BaseCsvWriter<K,V> |
addComment(String comment)
添加备注
|
BaseCsvWriter<K,V> |
addComments(Collection<String> comments)
添加备注
|
BaseCsvWriter<K,V> |
addRow(V row)
添加行
|
BaseCsvWriter<K,V> |
addRows(Collection<V> list)
添加行
|
BaseCsvWriter<K,V> |
capacity(int capacity)
设置数组容量
|
protected String[] |
capacityStore()
开辟数组
|
void |
close()
安全关闭
|
BaseCsvWriter<K,V> |
defaultValue(K k,
Object value)
默认值
|
void |
flush()
安全刷新以及强制写出
|
int |
getCapacity() |
CsvWriterOption |
getOption() |
CsvWriter |
getWriter() |
BaseCsvWriter<K,V> |
headers(String... headers)
添加表头
|
BaseCsvWriter<K,V> |
mapping(int column,
K k) |
BaseCsvWriter<K,V> |
mapping(int column,
K k,
Object defaultValue)
映射
|
protected abstract String[] |
parseRow(V row)
解析行
|
BaseCsvWriter<K,V> |
skip()
跳过一行
|
BaseCsvWriter<K,V> |
skip(int i)
跳过一行
|
BaseCsvWriter<K,V> |
skipNullRows(boolean skip)
跳过空行
|
protected final CsvWriter writer
protected boolean skipNullRows
protected int capacity
protected int maxColumnIndex
public BaseCsvWriter(CsvWriter writer)
public BaseCsvWriter<K,V> skip()
public BaseCsvWriter<K,V> skip(int i)
i
- 行public BaseCsvWriter<K,V> capacity(int capacity)
capacity
- capacitypublic BaseCsvWriter<K,V> skipNullRows(boolean skip)
skip
- 是否跳过public BaseCsvWriter<K,V> mapping(int column, K k)
public BaseCsvWriter<K,V> mapping(int column, K k, Object defaultValue)
column
- columnk
- valueKeydefaultValue
- defaultValuepublic BaseCsvWriter<K,V> defaultValue(K k, Object value)
k
- kvalue
- valuepublic BaseCsvWriter<K,V> headers(String... headers)
headers
- 表头public BaseCsvWriter<K,V> addRows(Collection<V> list)
list
- 行public BaseCsvWriter<K,V> addRow(V row)
row
- 行public BaseCsvWriter<K,V> addComments(Collection<String> comments)
comments
- commentspublic BaseCsvWriter<K,V> addComment(String comment)
comment
- commentprotected String[] capacityStore()
public void flush()
SafeFlushable
flush
in interface SafeFlushable
flush
in interface Flushable
public void close()
SafeCloseable
close
in interface SafeCloseable
close
in interface Closeable
close
in interface AutoCloseable
public CsvWriter getWriter()
public CsvWriterOption getOption()
public int getCapacity()
Copyright © 2024. All rights reserved.