| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectau.com.bytecode.opencsv.CSVWriter
public class CSVWriter
A very simple CSV writer released under a commercial-friendly license.
| Field Summary | |
|---|---|
| static char | DEFAULT_ESCAPE_CHARACTERThe character used for escaping quotes. | 
| static java.lang.String | DEFAULT_LINE_ENDDefault line terminator uses platform encoding. | 
| static char | DEFAULT_QUOTE_CHARACTERThe default quote character to use if none is supplied to the constructor. | 
| static char | DEFAULT_SEPARATORThe default separator to use if none is supplied to the constructor. | 
| static char | NO_ESCAPE_CHARACTERThe escape constant to use when you wish to suppress all escaping. | 
| static char | NO_QUOTE_CHARACTERThe 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,
          char escapechar)Constructs CSVWriter with supplied separator and quote char. | |
| CSVWriter(java.io.Writer writer,
          char separator,
          char quotechar,
          char escapechar,
          java.lang.String lineEnd)Constructs CSVWriter with supplied separator, quote char, escape char and line ending. | |
| 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 | flush()Flush underlying stream to writer. | 
|  void | writeAll(java.util.List allLines)Writes the entire list to a CSV file. | 
|  void | writeAll(java.sql.ResultSet rs,
         boolean includeColumnNames)Writes the entire ResultSet to a CSV file. | 
| protected  void | writeColumnNames(java.sql.ResultSetMetaData metadata) | 
|  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 | 
|---|
public static final char DEFAULT_ESCAPE_CHARACTER
public static final char DEFAULT_SEPARATOR
public static final char DEFAULT_QUOTE_CHARACTER
public static final char NO_QUOTE_CHARACTER
public static final char NO_ESCAPE_CHARACTER
public static final java.lang.String DEFAULT_LINE_END
| Constructor Detail | 
|---|
public CSVWriter(java.io.Writer writer)
writer - the writer to an underlying CSV source.
public CSVWriter(java.io.Writer writer,
                 char separator)
writer - the writer to an underlying CSV source.separator - the delimiter to use for separating entries.
public CSVWriter(java.io.Writer writer,
                 char separator,
                 char quotechar)
writer - the writer to an underlying CSV source.separator - the delimiter to use for separating entriesquotechar - the character to use for quoted elements
public CSVWriter(java.io.Writer writer,
                 char separator,
                 char quotechar,
                 char escapechar)
writer - the writer to an underlying CSV source.separator - the delimiter to use for separating entriesquotechar - the character to use for quoted elementsescapechar - the character to use for escaping quotechars or escapechars
public CSVWriter(java.io.Writer writer,
                 char separator,
                 char quotechar,
                 java.lang.String lineEnd)
writer - the writer to an underlying CSV source.separator - the delimiter to use for separating entriesquotechar - the character to use for quoted elementslineEnd - the line feed terminator to use
public CSVWriter(java.io.Writer writer,
                 char separator,
                 char quotechar,
                 char escapechar,
                 java.lang.String lineEnd)
writer - the writer to an underlying CSV source.separator - the delimiter to use for separating entriesquotechar - the character to use for quoted elementsescapechar - the character to use for escaping quotechars or escapecharslineEnd - the line feed terminator to use| Method Detail | 
|---|
public void writeAll(java.util.List allLines)
allLines - a List of String[], with each String[] representing a line of
            the file.
protected void writeColumnNames(java.sql.ResultSetMetaData metadata)
                         throws java.sql.SQLException
java.sql.SQLException
public void writeAll(java.sql.ResultSet rs,
                     boolean includeColumnNames)
              throws java.sql.SQLException,
                     java.io.IOException
rs - the recordset to writeincludeColumnNames - true if you want column names in the output, false otherwise
java.sql.SQLException
java.io.IOExceptionpublic void writeNext(java.lang.String[] nextLine)
nextLine - a string array with each comma-separated element as a separate
            entry.
public void flush()
           throws java.io.IOException
java.io.IOException - if bad things happen
public void close()
           throws java.io.IOException
java.io.IOException - if bad things happen| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||