public class AnnotationWriter extends TableWriter
Modifier and Type | Field and Description |
---|---|
private int |
columnCount |
private String |
filename |
private boolean |
hasPrintedHeaders |
private Set<Integer> |
usedIds |
out
Constructor and Description |
---|
AnnotationWriter(Writer out) |
Modifier and Type | Method and Description |
---|---|
void |
bfsPrintData(int id,
Object... data)
Print a data line.
|
void |
bfsPrintHeaders(String... headers)
Print the header line.
|
static AnnotationWriter |
create(File file)
Utility method for creating an annotation writer to a file in the BASE
file system.
|
static AnnotationWriter |
create(File file)
Utility method for creating an annotation writer to a file in the native
file system.
|
static AnnotationWriter |
create(OutputStream out,
String filename)
Utility method for creating an annotation writer when you have an
output stream.
|
int |
getColumnCount()
Get the number of data columns.
|
String |
getFilename()
Get the file name that this writer is printing to.
|
boolean |
hasPrintedHeaders()
Checks if headers has already been printed or not.
|
void |
setFilename(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 String filename
private boolean hasPrintedHeaders
private int columnCount
public AnnotationWriter(Writer out)
public static AnnotationWriter create(OutputStream out, String filename)
out
- The output stream the annotation writer should print tofilename
- Optional, the name of the file the output stream
is printing topublic static AnnotationWriter create(File file)
file
- The file in the BASE file systempublic static AnnotationWriter create(File file) throws IOException
file
- The file in the native file systemIOException
public String getFilename()
public void setFilename(String filename)
public boolean hasPrintedHeaders()
public int getColumnCount()
public void bfsPrintHeaders(String... headers)
headers
- The header columns, not including the ID columnIllegalStateException
- If headers has already been printedNullPointerException
- If any of the header values is nullIllegalArgumentException
- If a duplicate header is foundpublic void bfsPrintData(int id, Object... data)
id
- The id of the line, must be a unique positive integerdata
- The data to printIllegalStateException
- If headers has not been printedIllegalArgumentException
- If the ID values is not a unique postive
integer or if the size of the data array doesn't match the size of the
header arrayNullPointerException
- If the data array is null