Menu

Delimited Data Manager

William A. Hood

Delimited Data Manager

This class is useful for creating and managing text files containing delimited data, such as comma or tab separated values.

DelimitedDataManager<T> - Set the type parameter for the type of data being managed. The most common & useful type would probably be string.

DEFAULT_DELIMITER - If no other delimiting character is specified, the default is a comma. Tab-delimited data is also very common.
DEFAULT_SPACING - Indicates the number of spaces after the delimiter character. Usually this is fine to be left as one.

Constructors

DelimitedDataManager(String...) - This is the recommended constructor to use. It keeps the default delimiter character and default spacing. The string parameters are the data headers to use.
DelimitedDataManager(char, int, String...) - Same as the default constructor, but allows you to specify a different delimiter and spacing than the default.

Methods

length() - Returns the number of columns (same as the number of headers).
getDataRow(String, T) - Given the name of a header, and a value, returns all rows where that column has that value.
hasDataRow(String, T) - Given the name of a header, and a value, returns true if at least one row exists where that column has that value.
toFile(String) - Given a filename (complete path and extension) as input, writes the delimited data to the specified file. If the file already exists it is appended to.
toFile(String, Boolean) - Given a filename (complete path and extension) as input, writes the delimited data to the specified file. The boolean specifies whether to append (true) or clobber (false) if the file already exists.
stringRowFromTextLine(String) - This is used automatically when reading headers in a delimited data file, but may also be used manually. Given a line from a delimited data file matching the current configuration, it will return a single line of data AS STRINGS, rather than the chosen data type.
fromFile(String, Parser<T>) - Given a filename (complete path and extension) and Parser parameter this is used to generate a DeleimitedDataManager based on the specified file. This can be used if the data must be manipulated by a program that frequently starts and stops, as it may load its data, make changes, and save.
fromFile(String, char, Parser<T>) - Same as above, but allows specifying a non-default delimiter.
dataRowFromTextLine(String, Parser<T>) - This is used automatically when reading in a delimited data file, but may also be used manually. Given a line from a delimited data file matching the current configuration, it will return a single line of data.


Related

Wiki: Home

Monday.com Logo