|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.das2.dataset.parser.VectorDataSetParser
public class VectorDataSetParser
Class for reading ascii tables into a VectorDataSet. This parses a file by looking at each line to see if it matches one of two Patterns: one for properties and one for records. If a record matched, then the record is matched and fields pulled out, parsed and insered a VectorDataSetBuilder. If a property is matched, then the builder property is set. Two Patterns are provided NAME_COLON_VALUE_PATTERN and NAME_EQUAL_VALUE_PATTERN for convenience. The record pattern is currently the number of fields identified with whitespace in between. Note the X tags are just the record numbers.
Field Summary | |
---|---|
static java.util.regex.Pattern |
NAME_COLON_VALUE_PATTERN
|
static java.util.regex.Pattern |
NAME_EQUAL_VALUE_PATTERN
|
Method Summary | |
---|---|
static int |
guessFieldCount(java.lang.String filename)
return the field count that would result in the largest number of records parsed. |
static void |
main(java.lang.String[] args)
|
static VectorDataSetParser |
newParser(int fieldCount)
creates a parser with @param fieldCount fields, named "field0,...,fieldN" |
static VectorDataSetParser |
newParser(java.lang.String[] fieldNames)
creates a parser with the named fields. |
VectorDataSet |
readFile(java.lang.String filename)
Parse the file using the current settings. |
VectorDataSet |
readStream(java.io.InputStream in)
Parse the stream using the current settings. |
void |
setPropertyPattern(java.util.regex.Pattern propertyPattern)
specify the Pattern used to recognize properties. |
void |
setRecordCountLimit(int recordCountLimit)
limit the number of records read. |
void |
setSkipLines(int skipLines)
skip a number of lines before trying to parse anything. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.regex.Pattern NAME_COLON_VALUE_PATTERN
public static final java.util.regex.Pattern NAME_EQUAL_VALUE_PATTERN
Method Detail |
---|
public static int guessFieldCount(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public static VectorDataSetParser newParser(int fieldCount)
public static VectorDataSetParser newParser(java.lang.String[] fieldNames)
public void setSkipLines(int skipLines)
public void setRecordCountLimit(int recordCountLimit)
public void setPropertyPattern(java.util.regex.Pattern propertyPattern)
public VectorDataSet readStream(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public VectorDataSet readFile(java.lang.String filename) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |