public class TextAdapter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
TextAdapter.DateParser
used to allow applications to define their own date parsing
|
static interface |
TextAdapter.StreamProcessor |
| Constructor and Description |
|---|
TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
boolean onlyReadOneLine)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
java.util.Hashtable properties,
boolean onlyReadOneLine)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
java.util.Hashtable properties,
boolean onlyReadOneLine,
java.lang.String skipPatternString)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
java.util.Hashtable properties,
boolean onlyReadOneLine,
java.lang.String skipPatternString,
TextAdapter.StreamProcessor streamProcessor)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.lang.String filename)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.lang.String filename,
java.lang.String map,
java.lang.String params)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.net.URL url)
Create a VisAD FlatField from a remote Text (comma-, tab- or
blank-separated values) ASCII file
|
TextAdapter(java.net.URL url,
java.lang.String map,
java.lang.String params)
Create a VisAD FlatField from a local Text (comma-, tab- or
blank-separated values) ASCII file
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addDateParser(TextAdapter.DateParser dateParser)
used to allow applications to define their own date parsing
|
static double |
decodeLatLon(java.lang.String latlon)
A cut-and-paste from the IDV Misc method
Decodes a string representation of a latitude or longitude and
returns a double version (in degrees).
|
Field |
getData()
get the data
|
static java.lang.String |
getDelimiter(java.lang.String filename) |
static boolean |
isComment(java.lang.String line)
Is the given text line a comment
|
static void |
main(java.lang.String[] args) |
static Data |
processFile(java.lang.String file)
Read in the given file and return the processed data
|
static java.lang.String |
readLine(java.io.BufferedReader bis) |
public TextAdapter(java.lang.String filename)
throws java.io.IOException,
VisADException
filename - name of local file.java.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.lang.String filename,
java.lang.String map,
java.lang.String params)
throws java.io.IOException,
VisADException
filename - name of local file.map - the VisAD "MathType" as a string defining the FlatFieldparams - the list of parameters used to define what columns
of the text file correspond to what MathType parameters.java.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.net.URL url)
throws java.io.IOException,
VisADException
url - File URL.java.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.net.URL url,
java.lang.String map,
java.lang.String params)
throws java.io.IOException,
VisADException
url - File URL.map - the VisAD "MathType" as a string defining the FlatFieldparams - the list of parameters used to define what columns
of the text file correspond to what MathType parameters.java.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params)
throws java.io.IOException,
VisADException
inputStream - The input stream to read fromdelimiter - the delimitermap - the VisAD "MathType" as a string defining the FlatFieldparams - the list of parameters used to define what columns
of the text file correspond to what MathType parameters.java.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
boolean onlyReadOneLine)
throws java.io.IOException,
VisADException
inputStream - The input stream to read fromdelimiter - the delimitermap - the VisAD "MathType" as a string defining the FlatFieldparams - the list of parameters used to define what columns
of the text file correspond to what MathType parameters.onlyReadOneLine - If true then only read one line of data. This is used so client code can
read the meta data.java.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
java.util.Hashtable properties,
boolean onlyReadOneLine)
throws java.io.IOException,
VisADException
inputStream - The input stream to read fromdelimiter - the delimitermap - the VisAD "MathType" as a string defining the FlatFieldparams - the list of parameters used to define what columns
of the text file correspond to what MathType parameters.properties - propertiesonlyReadOneLine - If true then only read one line of data. This is used so client code can
read the meta data.java.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
java.util.Hashtable properties,
boolean onlyReadOneLine,
java.lang.String skipPatternString)
throws java.io.IOException,
VisADException
inputStream - The input stream to read fromdelimiter - the delimitermap - the VisAD "MathType" as a string defining the FlatFieldparams - the list of parameters used to define what columns
of the text file correspond to what MathType parameters.properties - propertiesonlyReadOneLine - If true then only read one line of data. This is used so client code can
read the meta data.skipPatternString - if non-null then skip any line that matches this patternjava.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public TextAdapter(java.io.InputStream inputStream,
java.lang.String delimiter,
java.lang.String map,
java.lang.String params,
java.util.Hashtable properties,
boolean onlyReadOneLine,
java.lang.String skipPatternString,
TextAdapter.StreamProcessor streamProcessor)
throws java.io.IOException,
VisADException
inputStream - The input stream to read fromdelimiter - the delimitermap - the VisAD "MathType" as a string defining the FlatFieldparams - the list of parameters used to define what columns
of the text file correspond to what MathType parameters.properties - propertiesonlyReadOneLine - If true then only read one line of data. This is used so client code can
read the meta data.skipPatternString - if non-null then skip any line that matches this patternstreamProcessor - Optional processor of the Tuple stream for point obsjava.io.IOException - if there was a problem reading the file.VisADException - if an unexpected problem occurs.public static java.lang.String getDelimiter(java.lang.String filename)
public static boolean isComment(java.lang.String line)
public static java.lang.String readLine(java.io.BufferedReader bis)
throws java.io.IOException
java.io.IOExceptionpublic static void addDateParser(TextAdapter.DateParser dateParser)
public Field getData()
public static Data processFile(java.lang.String file) throws java.lang.Exception
file - The file to read injava.lang.Exceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exceptionpublic static double decodeLatLon(java.lang.String latlon)
+/- ddd:mm, ddd:mm:, ddd:mm:ss, ddd::ss, ddd.fffff ===> [+/-] ddd.fffff +/- ddd, ddd:, ddd:: ===> [+/-] ddd +/- :mm, :mm:, :mm:ss, ::ss, .fffff ===> [+/-] .fffff +/- :, :: ===> 0.0 Any of the above with N,S,E,W appended
latlon - string representation of lat or lon