util
Class TxtReport

java.lang.Object
  |
  +--util.TxtReport
Direct Known Subclasses:
SimpleNDSMapReport, UImportRapport

public class TxtReport
extends java.lang.Object

base class for text report; comma-separated, tab-delimited or free form (space delimited)


Field Summary
private  int format
          format selection; default FORMAT_TAB
static int FORMAT_CSV
          constant passed to constructor used to select format
static int FORMAT_FREE
          constant passed to constructor used to select format
static int FORMAT_TAB
          constant passed to constructor used to select format
protected  java.lang.String[] header
          column names
static java.lang.String nl
           
protected  boolean printHeader
           
protected  java.io.PrintWriter printWriter
           
protected  boolean strict
          check if number of fields matches number of columnnames
static java.lang.String tab
           
 
Constructor Summary
TxtReport(java.io.Writer pw)
          default format is FORMAT_TAB
TxtReport(java.io.Writer pw, int format)
          create TxtReport; create printwriter based on param writer to enable autoflush
 
Method Summary
 void close()
          close underlying Writer
 int getFormat()
           
 void setHeader(java.lang.String[] sa)
          call before writeLine() if strict == true if header is set, first line of output is always header
 void writeHeader()
          write header at first call
 void writeLine(java.lang.String line)
          just write line
 void writeLine(java.lang.String[] fields)
          write fields in selected format to printwriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nl

public static final java.lang.String nl

tab

public static final java.lang.String tab
See Also:
Constant Field Values

FORMAT_TAB

public static int FORMAT_TAB
constant passed to constructor used to select format


FORMAT_CSV

public static int FORMAT_CSV
constant passed to constructor used to select format


FORMAT_FREE

public static int FORMAT_FREE
constant passed to constructor used to select format


format

private int format
format selection; default FORMAT_TAB


header

protected java.lang.String[] header
column names


strict

protected boolean strict
check if number of fields matches number of columnnames


printWriter

protected java.io.PrintWriter printWriter

printHeader

protected boolean printHeader
Constructor Detail

TxtReport

public TxtReport(java.io.Writer pw)
default format is FORMAT_TAB


TxtReport

public TxtReport(java.io.Writer pw,
                 int format)
create TxtReport; create printwriter based on param writer to enable autoflush

Method Detail

setHeader

public void setHeader(java.lang.String[] sa)
call before writeLine() if strict == true if header is set, first line of output is always header


getFormat

public int getFormat()

writeHeader

public void writeHeader()
write header at first call


writeLine

public void writeLine(java.lang.String line)
just write line


writeLine

public void writeLine(java.lang.String[] fields)
write fields in selected format to printwriter


close

public void close()
close underlying Writer