Package util
Class TableWriter
java.lang.Object
util.TableWriter
Class for writers for files with tabular data.
- Since:
- 2007.05.20
-
Constructor Summary
ConstructorsConstructorDescriptionTableWriter
(OutputStream stream) Create a table writer with default characters.TableWriter
(Writer writer) Create a table writer with default characters. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
close()
Close the underlying stream.final void
setBlank
(int blank) Set the blank character.final void
Set all separator characters.final void
setCharsCoded
(String seps) Set all separator characters.final void
setFldSep
(int fldsep) Set the field separator.final void
setNullChar
(int nullch) Set the null value character.final void
setRecSep
(int recsep) Set the record separator.final void
Write a field.final void
Write a field.final void
Write a field.final void
Write a field.final void
Write the last field of a record.final void
Write the last field of a record.
-
Constructor Details
-
TableWriter
Create a table writer with default characters.- Parameters:
writer
- the writer to work on- Since:
- 2007.05.20 (Christian Borgelt)
-
TableWriter
Create a table writer with default characters.- Parameters:
stream
- the output stream to write on- Throws:
IOException
- if a read error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-
-
Method Details
-
setRecSep
public final void setRecSep(int recsep) Set the record separator.- Parameters:
recsep
- the record separator- Since:
- 2007.05.20 (Christian Borgelt)
-
setFldSep
public final void setFldSep(int fldsep) Set the field separator.- Parameters:
fldsep
- the field separator- Since:
- 2007.05.20 (Christian Borgelt)
-
setBlank
public final void setBlank(int blank) Set the blank character.- Parameters:
blank
- the blank character- Since:
- 2007.05.20 (Christian Borgelt)
-
setNullChar
public final void setNullChar(int nullch) Set the null value character.- Parameters:
nullch
- the null value character- Since:
- 2007.05.20 (Christian Borgelt)
-
setChars
Set all separator characters.- Parameters:
seps
- the separators to use for writing
char 0: record separator
char 1: field separator
char 2: blank character (optional)
char 3: null value character (optional)- Since:
- 2007.05.20 (Christian Borgelt)
-
setCharsCoded
Set all separator characters.- Parameters:
seps
- the separators to use for writing- Since:
- 2007.05.20 (Christian Borgelt)
-
write
Write a field.- Parameters:
s
- the contents of the field to write- Throws:
IOException
- if an I/O error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-
write
Write a field.- Parameters:
s
- the contents of the field to writewidth
- the width to which to fill the field- Throws:
IOException
- if an I/O error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-
write
Write a field.- Parameters:
s
- the contents of the field to writelast
- whether this is the last field of a record- Throws:
IOException
- if an I/O error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-
write
Write a field.- Parameters:
s
- the contents of the field to writewidth
- the width to which to fill the fieldlast
- whether this is the last field of a record- Throws:
IOException
- if an I/O error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-
writeLast
Write the last field of a record.- Parameters:
s
- the contents of the field to write- Throws:
IOException
- if an I/O error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-
writeLast
Write the last field of a record.- Parameters:
s
- the contents of the field to writewidth
- the width to which to fill the field- Throws:
IOException
- if an I/O error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-
close
Close the underlying stream.- Throws:
IOException
- if an I/O error occurs- Since:
- 2007.05.20 (Christian Borgelt)
-