org.das2.dataset.parser.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.
NAME_COLON_VALUE_PATTERN
NAME_EQUAL_VALUE_PATTERN
guessFieldCount
guessFieldCount( String filename ) → int
return the field count that would result in the largest number of records parsed. The
entire file is scanned, and for each line the number of decimal fields is counted. At the end
of the scan, the fieldCount with the highest record count is returned.
Parameters
filename - a String
Returns:
int
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
main
main( String[] args ) → void
Parameters
args - a java.lang.String[]
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
newParser
newParser( int fieldCount ) → org.das2.dataset.parser.VectorDataSetParser
creates a parser with @param fieldCount fields, named "field0,...,fieldN"
Parameters
fieldCount - an int
Returns:
org.das2.dataset.parser.VectorDataSetParser
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
newParser( String[] fieldNames ) → org.das2.dataset.parser.VectorDataSetParser
readFile
readFile( String filename ) → org.das2.dataset.VectorDataSet
Parse the file using the current settings.
Parameters
filename - a String
Returns:
org.das2.dataset.VectorDataSet
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
readStream
readStream( java.io.InputStream in ) → org.das2.dataset.VectorDataSet
Parse the stream using the current settings.
Parameters
in - an InputStream
Returns:
org.das2.dataset.VectorDataSet
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
setPropertyPattern
setPropertyPattern( java.util.regex.Pattern propertyPattern ) → void
specify the Pattern used to recognize properties. Note property
values are not parsed, they are provided as Strings.
Parameters
propertyPattern - a Pattern
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
setRecordCountLimit
setRecordCountLimit( int recordCountLimit ) → void
limit the number of records read. parsing will stop at this limit.
Parameters
recordCountLimit - an int
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
setSkipLines
setSkipLines( int skipLines ) → void
skip a number of lines before trying to parse anything.
Parameters
skipLines - an int
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]