public class TabDataReader extends java.lang.Object implements DataReader
Modified by: Joseph A. Huwaldt
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXTENSION |
static java.lang.String |
NO_UNITS |
MAYBE, NO, RESOURCES, YES
Constructor and Description |
---|
TabDataReader() |
Modifier and Type | Method and Description |
---|---|
int |
canReadData(java.lang.String pathName,
java.io.BufferedInputStream input)
Method that determines if this reader can read data from the specified input
stream.
|
boolean |
canWriteData()
Returns true.
|
int |
compareTo(DataReader o)
Compares this object with the specified object for order based on the
toString().compareTo(o.toString()) method. |
java.lang.String |
getExtension()
Returns the preferred file extension (not including the ".") for files of this
DataReader's type.
|
java.util.List<DataSet> |
read(java.lang.String pathName,
java.io.InputStream input)
Method that reads in tab, space or comma delimited array data from the specified
input stream and returns that data as a list of
DataSet objects. |
java.util.List<DataSet> |
selectDataForSaving(java.awt.Frame parent,
java.util.List<DataSet> data)
The Tabbed Array format can save only a single case of arrays.
|
void |
setDefaultSetName(java.lang.CharSequence name)
Sets the default set name to use.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
void |
write(java.io.OutputStream output,
java.util.List<DataSet> data)
Method that writes out all the data stored in the specified list of
DataSet
objects to the specified output stream in tabbed array format. |
public static final java.lang.String NO_UNITS
public static final java.lang.String EXTENSION
public TabDataReader()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getExtension()
getExtension
in interface DataReader
public int compareTo(DataReader o)
toString().compareTo(o.toString())
method. Returns a negative integer,
zero, or a positive integer as this object is less than, equal to, or greater than
the specified object.compareTo
in interface java.lang.Comparable<DataReader>
public int canReadData(java.lang.String pathName, java.io.BufferedInputStream input) throws java.io.IOException
canReadData
in interface DataReader
pathName
- The path to the file to be read.input
- An input stream containing the data to be read. Any methods that
read from this stream must first set a mark and then reset back to
that mark before the method returns (even if it returns with an
exception).java.io.IOException
- If the input stream could not be read.public boolean canWriteData()
canWriteData
in interface DataReader
public java.util.List<DataSet> selectDataForSaving(java.awt.Frame parent, java.util.List<DataSet> data)
selectDataForSaving
in interface DataReader
parent
- Determines the Frame in which the dialog is displayed; if null, or if
the parentComponent has no Frame, a default Frame is used.data
- The input data set that is to be selected for saving.public java.util.List<DataSet> read(java.lang.String pathName, java.io.InputStream input) throws java.io.IOException
DataSet
objects.read
in interface DataReader
pathName
- The path to the file to be read.input
- An input stream containing the tab, space or comma delimited array
data.java.io.IOException
- If there is a problem reading the specified stream.public void write(java.io.OutputStream output, java.util.List<DataSet> data) throws java.io.IOException
DataSet
objects to the specified output stream in tabbed array format. Only the 1st case in
the 1st data set in the specified list is written out since the tabbed array format
does not support multiple cases. Only arrays are written out since the tabbed array
format does not support scalars or text notes.write
in interface DataReader
output
- The output stream to which the data is to be written.data
- A list of DataSet
objects containing data to be written out.
Only the 1st case in the 1st data set in the list is written out.java.io.IOException
- If there is a problem writing to the specified stream.public void setDefaultSetName(java.lang.CharSequence name)
setDefaultSetName
in interface DataReader
name
- The name to use as the default set name.