public class FlatFileEx1 extends FlatFile
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.
FlatFile.Parser
AbstractFlatFile.FlatFileSQLException, AbstractFlatFile.FlatFileSQLFeatureNotSupportedException
PARSE_BYTE, PARSE_DOUBLE, PARSE_FLOAT, PARSE_INTEGER, PARSE_LONG, PARSE_SHORT
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 and Description |
---|
FlatFileEx1(InputStream is) |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args) |
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, updateSQLXML
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, wasNull
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
updateObject, updateObject, updateObject, updateObject
public FlatFileEx1(InputStream is) throws IOException
IOException
public static void main(String[] args) throws SQLException, IOException
SQLException
IOException
Copyright © 2020 Rogue Wave Software. All rights reserved.