scriptella.driver.csv.opencsv
Class CSVWriter

java.lang.Object
  extended by scriptella.driver.csv.opencsv.CSVWriter
All Implemented Interfaces:
java.io.Closeable

public class CSVWriter
extends java.lang.Object
implements java.io.Closeable

A very simple CSV writer released under a commercial-friendly license.

Author:
Glen Smith, Fyodor Kupolov

Field Summary
static java.lang.String DEFAULT_LINE_END
          Default line terminator uses platform encoding.
static char DEFAULT_QUOTE_CHARACTER
          The default quote character to use if none is supplied to the constructor.
static char DEFAULT_SEPARATOR
          The default separator to use if none is supplied to the constructor.
static char ESCAPE_CHARACTER
          The character used for escaping quotes.
static char NO_QUOTE_CHARACTER
          The quote constant to use when you wish to suppress all quoting.
 
Constructor Summary
CSVWriter(java.io.Writer writer)
          Constructs CSVWriter using a comma for the separator.
CSVWriter(java.io.Writer writer, char separator)
          Constructs CSVWriter with supplied separator.
CSVWriter(java.io.Writer writer, char separator, char quotechar)
          Constructs CSVWriter with supplied separator and quote char.
CSVWriter(java.io.Writer writer, char separator, char quotechar, java.lang.String lineEnd)
          Constructs CSVWriter with supplied separator and quote char.
 
Method Summary
 void close()
          Close the underlying stream writer flushing any buffered content.
 void writeNext(java.lang.String[] nextLine)
          Writes the next line to the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ESCAPE_CHARACTER

public static final char ESCAPE_CHARACTER
The character used for escaping quotes.

See Also:
Constant Field Values

DEFAULT_SEPARATOR

public static final char DEFAULT_SEPARATOR
The default separator to use if none is supplied to the constructor.

See Also:
Constant Field Values

DEFAULT_QUOTE_CHARACTER

public static final char DEFAULT_QUOTE_CHARACTER
The default quote character to use if none is supplied to the constructor.

See Also:
Constant Field Values

NO_QUOTE_CHARACTER

public static final char NO_QUOTE_CHARACTER
The quote constant to use when you wish to suppress all quoting.

See Also:
Constant Field Values

DEFAULT_LINE_END

public static final java.lang.String DEFAULT_LINE_END
Default line terminator uses platform encoding.

See Also:
Constant Field Values
Constructor Detail

CSVWriter

public CSVWriter(java.io.Writer writer)
Constructs CSVWriter using a comma for the separator.

Parameters:
writer - the writer to an underlying CSV source.

CSVWriter

public CSVWriter(java.io.Writer writer,
                 char separator)
Constructs CSVWriter with supplied separator.

Parameters:
writer - the writer to an underlying CSV source.
separator - the delimiter to use for separating entries.

CSVWriter

public CSVWriter(java.io.Writer writer,
                 char separator,
                 char quotechar)
Constructs CSVWriter with supplied separator and quote char.

Parameters:
writer - the writer to an underlying CSV source.
separator - the delimiter to use for separating entries
quotechar - the character to use for quoted elements

CSVWriter

public CSVWriter(java.io.Writer writer,
                 char separator,
                 char quotechar,
                 java.lang.String lineEnd)
Constructs CSVWriter with supplied separator and quote char.

Parameters:
writer - the writer to an underlying CSV source.
separator - the delimiter to use for separating entries
quotechar - the character to use for quoted elements
lineEnd - the line feed terminator to use
Method Detail

writeNext

public void writeNext(java.lang.String[] nextLine)
               throws java.io.IOException
Writes the next line to the file.

Parameters:
nextLine - a string array with each comma-separated element as a separate entry.
Throws:
java.io.IOException - if I/O error occurs

close

public void close()
           throws java.io.IOException
Close the underlying stream writer flushing any buffered content.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException - if bad things happen


Copyright © Copyright 2006-2009 The Scriptella Project Team.