public class DataWriter extends TableWriter
TabCrLfEncoderDecoder
). All
rows must have an equal number of columns. The number of columns is
defined by the first call to bfsPrintData(Object...)
or by calling setColumnCount(int)
.Modifier and Type | Field and Description |
---|---|
private int |
columnCount |
private java.lang.String |
filename |
private boolean |
lockedColumns |
Constructor and Description |
---|
DataWriter(java.io.Writer out)
Create a new BFS data writer.
|
Modifier and Type | Method and Description |
---|---|
void |
bfsPrintData(java.lang.Object... data)
Print a data line.
|
static DataWriter |
create(File file)
Utility method for creating a data writer to a file in the BASE
file system.
|
static DataWriter |
create(java.io.File file)
Utility method for creating a data writer to a file in the native
file system.
|
static DataWriter |
create(java.io.OutputStream out,
java.lang.String filename)
Utility method for creating a data writer when you have an
output stream.
|
int |
getColumnCount()
Get the number of data columns.
|
java.lang.String |
getFilename()
Get the file name that this writer is printing to.
|
boolean |
isLockedColumns()
Checks if the number of columns has been locked or not.
|
void |
setColumnCount(int columns)
Set the number of data columns.
|
void |
setFilename(java.lang.String filename)
Set the file name that this writer is printing to.
|
getDataSeparator, getEncoder, getNullValue, setDataSeparator, setEncoder, setNullValue, tableEncode, tablePrintData, tablePrintData
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
private java.lang.String filename
private boolean lockedColumns
private int columnCount
public DataWriter(java.io.Writer out)
out
- The parent writer which this writer will print topublic static DataWriter create(java.io.OutputStream out, java.lang.String filename)
out
- The output stream the writer should print tofilename
- Optional, the name of the file the output stream
is printing topublic static DataWriter create(File file)
file
- The file in the BASE file systempublic static DataWriter create(java.io.File file) throws java.io.IOException
file
- The file in the native file systemjava.io.IOException
public java.lang.String getFilename()
public void setFilename(java.lang.String filename)
public int getColumnCount()
public void setColumnCount(int columns)
columns
- The number of data columns, if 0 or negative the
first call to bfsPrintData(Object...)
determines
the number of columnspublic boolean isLockedColumns()
bfsPrintData(Object...)
is made.public void bfsPrintData(java.lang.Object... data)
setColumnCount(int)
.data
- The data to printjava.lang.IllegalStateException
- If headers has not been printedjava.lang.IllegalArgumentException
- If the data array doesn't match the
required number of columnsjava.lang.NullPointerException
- If the data array is null