|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.io.FieldContainer
de.fu_berlin.ties.io.DelimSepValues
A field container that stores and processed its contents as values separated by a pipe character ('|'). Entries are separated by newlines.
The very first non-comment line contains the field names, separated by
pipes. Each further non-comment lines contains the values of a entry
(FieldMap
). The first non-comment line must
contain as least as most pipes as each further line, so the field names
are known for all fields of all field maps. Empty fields are ignored when
populating field maps.
The '#' character can be used to introduce comment lines. Comments and lines that are empty or contain only whitespace are ignored when reading data.
Pipe characters and newlines within fields and '#' at the begin of the first field of an entry are escaped with a backslash. The recommended character set for storing delimiter-separated values is UTF-8.
Floats and doubles are formatted (rounded) via
Util.format(double)
.
Field Summary | |
static char |
COMMENT_START
The character introducing a comment: '#'. |
static char |
DELIM
The field delimiter character: '|' (a pipe). |
static char |
ESCAPE
The escape character: '\' (a backslash). |
static String |
FILE_EXT
The recommended file extension for this format: "dsv" (delimiter-separated values). |
Constructor Summary | |
DelimSepValues()
Creates a new empty instance. |
|
DelimSepValues(CharSequence input)
Creates a new instance from serialized delimiter-separated values. |
|
DelimSepValues(InputStream in)
Creates a new instance from serialized delimiter-separated values. |
|
DelimSepValues(Reader reader)
Creates a new instance from serialized delimiter-separated values. |
|
DelimSepValues(StorableContainer contents)
Creates a new instance and populates it from a StorableContainer . |
Method Summary | |
void |
store(Writer writer)
Serializes contents as delimiter-separated values. |
Methods inherited from class de.fu_berlin.ties.io.FieldContainer |
add, add, add, add, addKey, createFieldContainer, createFieldContainer, createFieldContainer, createFieldContainer, createObjects, entryIterator, keyCount, keyIterator, recommendedExtension, size, store, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String FILE_EXT
public static final char COMMENT_START
public static final char ESCAPE
public static final char DELIM
Constructor Detail |
public DelimSepValues()
public DelimSepValues(CharSequence input) throws IllegalArgumentException
input
- the input data to process
IllegalArgumentException
- if the input data contains errors,
e.g. when there are insufficient field names given in the first
non-comment linepublic DelimSepValues(InputStream in) throws IOException, IllegalArgumentException
in
- a stream containing the input data to process, must use the
UTF-8 charset; the stream is not closed by this method
IOException
- if an I/O error occurs while reading from the stream
IllegalArgumentException
- if the input data contains errors,
esp. when there are insufficient field names given in the first
non-comment linepublic DelimSepValues(Reader reader) throws IOException, IllegalArgumentException
reader
- a reader containing the input data to process; not closed
by this method
IOException
- if an I/O error occurs while reading
IllegalArgumentException
- if the input data contains errors,
esp. when there are insufficient field names given in the first
non-comment linepublic DelimSepValues(StorableContainer contents)
StorableContainer
.
contents
- the contents to add by calling
StorableContainer.storeEntries(FieldContainer)
Method Detail |
public void store(Writer writer) throws IOException
store
in class FieldContainer
writer
- the writer to write to; flushed but not closed by this
method
IOException
- if an I/O error occurs while writing to the stream
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |