Class FlatFileEx1
- All Implemented Interfaces:
AutoCloseable,ResultSet,Wrapper
Reads Fisher's Iris data set from a CSV file.
The Fisher iris data set is frequently used as a sample statistical data set. This example reads the data set in a CSV (comma separated value) format.
The first few lines of the data set are as follows:
Species,Sepal Length,Sepal Width,Petal Length,Petal Width
1.0, 5.1, 3.5, 1.4, .2
1.0, 4.9, 3.0, 1.4, .2
1.0, 4.7, 3.2, 1.3, .2
1.0, 4.6, 3.1, 1.5, .2
1.0, 5.0, 3.6, 1.4, .2
1.0, 5.4, 3.9, 1.7, .4
The first line contains the column names, with a comma as the separator. The
rest of the lines contain double data, one observation per line,
with comma as a separator.
This example extends the class FlatFile. The FlatFileEx1
constructor constructs a BufferedReader object and calls the
FlatFile constructor. It then reads the line containing the
column names. The column names are parsed and used to set the column names in
FlatFile. All of the columns are also set to type
Double.
The class FlatFileEx1 is used in the method main.
The data set is assumed to be in a file called "FisherIris.csv" in the same
location as the example class file, so that getResourceAsStream
can be used to open the file as a stream. Summary statistics are computed for
the "Sepal Width" column.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.imsl.io.FlatFile
FlatFile.ParserNested classes/interfaces inherited from class com.imsl.io.AbstractFlatFile
AbstractFlatFile.FlatFileSQLException, AbstractFlatFile.FlatFileSQLFeatureNotSupportedException -
Field Summary
Fields inherited from class com.imsl.io.FlatFile
PARSE_BYTE, PARSE_DOUBLE, PARSE_FLOAT, PARSE_INTEGER, PARSE_LONG, PARSE_SHORTFields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.imsl.io.FlatFile
doGetBytes, doNext, getColumnCount, getHoldability, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getRowId, getRowId, getSQLXML, getSQLXML, isClosed, isWrapperFor, readLine, setColumnClass, setColumnParser, setDateColumnParser, unwrap, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateRowId, updateRowId, updateSQLXML, updateSQLXMLMethods inherited from class com.imsl.io.AbstractFlatFile
absolute, afterLast, beforeFirst, beginGet, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, findColumnName, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getColumnClass, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getMetaData, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getShort, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setColumnName, setFetchDirection, setFetchSize, setWarning, updateArray, updateArray, updateBigDecimal, updateBigDecimal, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNullMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.ResultSet
updateObject, updateObject, updateObject, updateObject
-
Constructor Details
-
FlatFileEx1
- Throws:
IOException
-
-
Method Details
-
main
- Throws:
SQLExceptionIOException
-