ucar.nc2.util
Class TableParser

java.lang.Object
  extended by ucar.nc2.util.TableParser

public class TableParser
extends java.lang.Object

Utility class to read and parse a fixed length table.

Version:
$Revision:63 $ $Date:2006-07-12 21:50:51Z $
Author:
caron

Nested Class Summary
static class TableParser.Record
          A set of values for one line.
 
Constructor Summary
TableParser()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static java.util.ArrayList readTable(java.io.InputStream ios, java.lang.String format, int maxLines)
          Reads an input stream, containing lines of ascii in fixed width format.
static java.util.ArrayList readTable(java.lang.String urlString, java.lang.String format, int maxLines)
          Reads a URL or file in as a table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableParser

public TableParser()
Method Detail

readTable

public static java.util.ArrayList readTable(java.lang.String urlString,
                                            java.lang.String format,
                                            int maxLines)
                                     throws java.io.IOException,
                                            java.lang.NumberFormatException
Reads a URL or file in as a table.

Parameters:
urlString - starts with http, read URL contenets, else read file.
Throws:
java.io.IOException
java.lang.NumberFormatException
See Also:
readTable(InputStream ios, String format, int maxLines)

readTable

public static java.util.ArrayList readTable(java.io.InputStream ios,
                                            java.lang.String format,
                                            int maxLines)
                                     throws java.io.IOException,
                                            java.lang.NumberFormatException
Reads an input stream, containing lines of ascii in fixed width format. Breaks each line into a set of Fields (space or comma delimited) which may be String, integer or double.

Parameters:
ios - the input stream
format - describe format of each line.
maxLines - maximum number of lines to parse, set to < 0 to read all
Returns:
List of TableParser.Record
Throws:
java.io.IOException
java.lang.NumberFormatException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException