|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthudson.plugins.tfs.util.TextTableParser
public class TextTableParser
Parser for the text table output from the TF tool. The table will always begin with a number of columns that specifies how wide each column is. The text table parser will use the number of columns and their width to be able to parse the lines that comes after the column definition. Some columns are optional, ie they does not contain any data and the line ends before the optional column begins.
An example of how a separator definition may look. The table consists of 3 columns; column 1 contains a string with at most 5 chars, column 2 contains a string with at most 2 chars and column 3 may contain a string with at most 4 chars. The third column is optional.
----- -- ---- Data1 A Data Data2 B Data3 C Data
TextTableParser t = new TextTableParser(reader, 1);
t.nextRow() // first row
assertEquals("Data1", t.getColumn(0));
assertEquals("Data", t.getColumn(2));
t.nextRow(); // Second row
assertEquals("Data2", t.getColumn(0));
assertNull(t.getColumn(2));
t.nextRow(); // Third row
assertEquals("Data3", t.getColumn(0));
assertEquals("Data", t.getColumn(2));
| Constructor Summary | |
|---|---|
TextTableParser(java.io.Reader reader)
|
|
TextTableParser(java.io.Reader reader,
int optionalColumnCount)
|
|
| Method Summary | |
|---|---|
java.lang.String |
getColumn(int index)
Return the value in the specified column |
int |
getColumnCount()
Returns the number of columns |
boolean |
nextRow()
Move to the next row |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextTableParser(java.io.Reader reader)
throws java.io.IOException
java.io.IOException
public TextTableParser(java.io.Reader reader,
int optionalColumnCount)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public int getColumnCount()
throws java.io.IOException
java.io.IOException
public java.lang.String getColumn(int index)
throws java.io.IOException
index - the column index
java.io.IOException
public boolean nextRow()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||