Class StringTable
- All Implemented Interfaces:
Cloneable
-
Field Summary
Fields inherited from class Table
columnHeadings, rowsModifier and TypeFieldDescriptionprotected final SimpleVector<String> protected final ArrayList<SimpleVector<String>> -
Constructor Summary
ConstructorsConstructorDescriptioncreate an empty tablecreate an empty table with the same column headings as tStringTable(String[] columns) create an empty table with the given column headings -
Method Summary
Modifier and TypeMethodDescriptionclone()static StringTablereadFromDirectTextFile(String fileName, Character comment) read from a direct (native) text filestatic StringTablereadFromStream(InputStream s, Character commentToken) static StringTablereadFromStream(InputStream s, Character commentToken, @Nullable Character delimiter) static StringTablereadFromTextFile(File f, Character comment) static StringreadNextNonCommentLine(LineNumberReader reader, Character commentToken) Methods inherited from class Table
addRow, computeColumnWidths, getColumnHeading, getElement, getNumberOfColumns, getNumberOfRows, padWithSpaces, removeRow, row2Map, toStringModifier and TypeMethodDescriptionvoidint[]getColumnHeading(int i) Note that column indices start at zerogetElement(int row, int column) intintstatic voidpadWithSpaces(StringBuilder b, int length) voidrow2Map(int row) toString()
-
Constructor Details
-
StringTable
public StringTable()create an empty table -
StringTable
create an empty table with the same column headings as t -
StringTable
create an empty table with the given column headings
-
-
Method Details
-
readFromDirectTextFile
public static StringTable readFromDirectTextFile(String fileName, Character comment) throws IOException read from a direct (native) text file- Throws:
IllegalArgumentException- if fileName is nullIOException
-
readFromTextFile
- Parameters:
f- a file containing a table in text format, whitespace delimited- Throws:
IOException
-
readFromStream
- Parameters:
s- a stream containing a table in text format, whitespace delimited- Throws:
IllegalArgumentException- if s is nullIOException
-
readFromStream
public static StringTable readFromStream(InputStream s, Character commentToken, @Nullable Character delimiter) throws IOException - Parameters:
s- a stream containing a table in text format, whitespace delimited- Throws:
IllegalArgumentException- if s is nullIOException
-
readNextNonCommentLine
public static String readNextNonCommentLine(LineNumberReader reader, Character commentToken) throws IOException - Throws:
IOException
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-