CSVPrinter (Solr 3.6.2 API)
Keywords: org.apache.solr.internal.csv.CSVPrinter class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.internal.csv
Class CSVPrinter

    java.lang.Object
      org.apache.solr.internal.csv.CSVPrinter

    public class CSVPrinter

extends Object

Print values as a comma separated list.

Field Summary
`protected char[]` | `buf`
`protected boolean` | `newLine` True if we just began a new line.
`protected Writer` | `out` The place that the values get written.
`protected CSVStrategy` | `strategy`

Constructor Summary
`CSVPrinter(Writer out, CSVStrategy strategy)` Create a printer that will print values to the given stream following the CSVStrategy.

Method Summary
`void` | `flush()`
`void` | `print(char[] value, int offset, int len, boolean checkForEscape)`
`void` | `print(String value)` Print the string as the next value on the line.
`void` | `print(String value, boolean checkForEscape)` Print the string as the next value on the line.
`void` | `println()` Output a blank line
`void` | `println(String[] values)` Print a single line of comma separated values.
`void` | `printlnComment(String comment)` Put a comment among the comma separated values.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### out

    protected final Writer out

  The place that the values get written.

### strategy

    protected final CSVStrategy strategy

### newLine

    protected boolean newLine

  True if we just began a new line.

### buf

    protected char[] buf

Constructor Detail

### CSVPrinter

    public CSVPrinter(Writer out,
                      CSVStrategy strategy)

  Create a printer that will print values to the given stream following the CSVStrategy. Currently, only a pure encapsulation strategy or a pure escaping strategy is supported. Hybrid strategies (encapsulation and escaping with a different character) are not supported.

  Parameters:
    `out` - stream to which to print.
    `strategy` - describes the CSV variation.

Method Detail

### println

    public void println()
                 throws IOException

  Output a blank line

  Throws:
    `IOException`

### flush

    public void flush()
               throws IOException

  Throws:
    `IOException`

### println

    public void println(String[] values)
                 throws IOException

  Print a single line of comma separated values. The values will be quoted if needed. Quotes and newLine characters will be escaped.

  Parameters:
    `values` - values to be outputted.
  Throws:
    `IOException`

### printlnComment

    public void printlnComment(String comment)
                        throws IOException

  Put a comment among the comma separated values. Comments will always begin on a new line and occupy a least one full line. The character specified to star comments and a space will be inserted at the beginning of each new line in the comment.

  Parameters:
    `comment` - the comment to output
  Throws:
    `IOException`

### print

    public void print(char[] value,
                      int offset,
                      int len,
                      boolean checkForEscape)
               throws IOException

  Throws:
    `IOException`

### print

    public void print(String value,
                      boolean checkForEscape)
               throws IOException

  Print the string as the next value on the line. The value will be escaped or encapsulated as needed if checkForEscape==true

  Parameters:
    `value` - value to be outputted.
  Throws:
    `IOException`

### print

    public void print(String value)
               throws IOException

  Print the string as the next value on the line. The value will be escaped or encapsulated as needed.

  Parameters:
    `value` - value to be outputted.
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD