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

com.github.zhangxd1989.basetool.text.csv.CsvWriteConfig Maven / Gradle / Ivy

There is a newer version: 1.0.16
Show newest version
package com.github.zhangxd1989.basetool.text.csv;


import com.github.zhangxd1989.basetool.util.CharUtil;

import java.io.Serializable;

/**
 * CSV写出配置项
 *
 * @author sheldon
 */
public class CsvWriteConfig extends CsvConfig implements Serializable {

    private static final long serialVersionUID = 853053196586521445L;

    /**
     * 是否始终使用文本分隔符,文本包装符,默认false,按需添加
     */
    protected boolean alwaysDelimitText;
    /**
     * 换行符
     */
    protected char[] lineDelimiter = {CharUtil.CR, CharUtil.LF};

    /**
     * 默认配置
     *
     * @return 默认配置
     */
    public static CsvWriteConfig defaultConfig() {
        return new CsvWriteConfig();
    }

    /**
     * 设置是否始终使用文本分隔符,文本包装符,默认false,按需添加
     *
     * @param alwaysDelimitText 是否始终使用文本分隔符,文本包装符,默认false,按需添加
     */
    public void setAlwaysDelimitText(boolean alwaysDelimitText) {
        this.alwaysDelimitText = alwaysDelimitText;
    }

    /**
     * 设置换行符
     *
     * @param lineDelimiter 换行符
     */
    public void setLineDelimiter(char[] lineDelimiter) {
        this.lineDelimiter = lineDelimiter == null ? null : lineDelimiter.clone();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy