olg.csv.base.csv
Class CSVSettings

Package class diagram package CSVSettings
java.lang.Object
  extended by olg.csv.base.csv.CSVSettings

public class CSVSettings
extends Object

CSV Settings class to reading and writing.

See Also:
CSVWriter, CSVReader

Field Summary
private  String charsetName
          Charset.
static String DEFAULT_CHARSETNAME
          Default charset of this Java virtual machine.
static char DEFAULT_DELIMITER
          Default delimiter.
static boolean DEFAULT_FORCEDELIMITER
          Default force delimiter.
static String DEFAULT_LINESEPARATOR
          Default line separator :operating system line separator.
static char DEFAULT_SEPARATOR
          default separator.
static boolean DEFAULT_SKIPEMPTYCELL
          Default option on skipping empty cell.
static boolean DEFAULT_WITHHEADERS
          Default with headers value.
private  char delimiter
          Cell delimiter.
private  boolean forceDelimiter
          Only for writing.
private  String lineSeparator
          line separator. by default DEFAULT_LINESEPARATOR.
static String LINUX_LINESEPARATOR
          Linux line separator.
static String MAC_LINESEPARATOR
          Mac Line serapator.
private  char separator
          Cell separator.
private  boolean skipEmptyCell
          Only for reading.
static String WINDOWS_LINESEPARATOR
          Dos line separator.
private  boolean withHeaders
          By default DEFAULT_WITHHEADERS.
 
Constructor Summary
CSVSettings()
          CSV settings with default values.
CSVSettings(char delimiter, char separator)
          Defines settings with specified values.
CSVSettings(char delimiter, char separator, boolean withHeaders)
          Defines settings with specified values.
 
Method Summary
 String getCharsetName()
           
 char getDelimiter()
           
 String getLineSeparator()
          The line separator setting.
 char getSeparator()
           
 boolean isForceDelimiter()
          Indicate if each CSV field must to be delimited.
 boolean isSkipEmptyCell()
           
 boolean isWithHeaders()
          Indicates if the CSV file has headers.
 CSVSettings setCharsetName(String charsetName)
           
 CSVSettings setDelimiter(char delimiter)
           
 CSVSettings setForceDelimiter(boolean forceDelimiter)
           
 CSVSettings setLineSeparator(String lineSeparator)
           
 CSVSettings setSeparator(char separator)
           
 CSVSettings setSkipEmptyCell(boolean skipEmptyCell)
          Only for reading. if true the returned rows will only contain not empty cells.
 CSVSettings setWithHeaders(boolean withHeaders)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DELIMITER

public static final char DEFAULT_DELIMITER
Default delimiter.

See Also:
Constant Field Values

DEFAULT_SEPARATOR

public static final char DEFAULT_SEPARATOR
default separator.

See Also:
Constant Field Values

DEFAULT_CHARSETNAME

public static final String DEFAULT_CHARSETNAME
Default charset of this Java virtual machine.


DEFAULT_LINESEPARATOR

public static final String DEFAULT_LINESEPARATOR
Default line separator :operating system line separator.


MAC_LINESEPARATOR

public static final String MAC_LINESEPARATOR
Mac Line serapator.

See Also:
Constant Field Values

LINUX_LINESEPARATOR

public static final String LINUX_LINESEPARATOR
Linux line separator.

See Also:
Constant Field Values

WINDOWS_LINESEPARATOR

public static final String WINDOWS_LINESEPARATOR
Dos line separator.

See Also:
Constant Field Values

DEFAULT_FORCEDELIMITER

public static final boolean DEFAULT_FORCEDELIMITER
Default force delimiter.

See Also:
Constant Field Values

DEFAULT_WITHHEADERS

public static final boolean DEFAULT_WITHHEADERS
Default with headers value.

See Also:
Constant Field Values

DEFAULT_SKIPEMPTYCELL

public static final boolean DEFAULT_SKIPEMPTYCELL
Default option on skipping empty cell.

See Also:
Constant Field Values

delimiter

private char delimiter
Cell delimiter. By default DEFAULT_DELIMITER.


separator

private char separator
Cell separator. By default DEFAULT_SEPARATOR.


charsetName

private String charsetName
Charset. By default DEFAULT_CHARSETNAME.


forceDelimiter

private boolean forceDelimiter
Only for writing. By default DEFAULT_FORCEDELIMITER. if true, all cells should be delimited by delimiter character.


withHeaders

private boolean withHeaders
By default DEFAULT_WITHHEADERS.


skipEmptyCell

private boolean skipEmptyCell
Only for reading. By default DEFAULT_SKIPEMPTYCELL. Reading policy: if true the returned rows will only contain not empty cells.


lineSeparator

private String lineSeparator
line separator. by default DEFAULT_LINESEPARATOR.

Constructor Detail

CSVSettings

public CSVSettings()
CSV settings with default values.


CSVSettings

public CSVSettings(char delimiter,
                   char separator)
Defines settings with specified values. Others fields are defined by default.

Parameters:
delimiter - the delimiter
separator - the separator

CSVSettings

public CSVSettings(char delimiter,
                   char separator,
                   boolean withHeaders)
Defines settings with specified values. Others fields are defined by default.

Parameters:
delimiter - the delimiter
separator - the separator
withHeaders - if the CSV file has headers.
Method Detail

getDelimiter

public char getDelimiter()
Returns:
the delimiter

setDelimiter

public CSVSettings setDelimiter(char delimiter)
Parameters:
delimiter - the delimiter
Returns:
the current settings

getSeparator

public char getSeparator()
Returns:
the separator.

setSeparator

public CSVSettings setSeparator(char separator)
Parameters:
separator - the separator
Returns:
the current settings

getCharsetName

public String getCharsetName()
Returns:
the charset name.

setCharsetName

public CSVSettings setCharsetName(String charsetName)
Parameters:
charsetName - the charset name
Returns:
the current settings.

isForceDelimiter

public boolean isForceDelimiter()
Indicate if each CSV field must to be delimited.

Returns:
if the use of delimiter is forced(CSV writing).

setForceDelimiter

public CSVSettings setForceDelimiter(boolean forceDelimiter)
Parameters:
forceDelimiter - the forceDelimiter setting.
Returns:
the current settings.

isWithHeaders

public boolean isWithHeaders()
Indicates if the CSV file has headers.

Returns:
the withHeader setting.

setWithHeaders

public CSVSettings setWithHeaders(boolean withHeaders)
Parameters:
withHeaders - the withHeader setting.
Returns:
the current settings.

isSkipEmptyCell

public boolean isSkipEmptyCell()
Returns:
if true the returned rows will only contain not empty cells.

setSkipEmptyCell

public CSVSettings setSkipEmptyCell(boolean skipEmptyCell)
Only for reading. if true the returned rows will only contain not empty cells.

Parameters:
skipEmptyCell - the skipEmptyCell setting.
Returns:
the current settings.

getLineSeparator

public String getLineSeparator()
The line separator setting.

Returns:
the line separator setting.

setLineSeparator

public CSVSettings setLineSeparator(String lineSeparator)
Parameters:
lineSeparator - the line separator setting.
Returns:
the current settings.


Copyright © 2014. All rights reserved.