FileDataSource STATBEAN®


Purpose: This file data collection tool reads data from a file on a local hard disk and saves the results in an invisible rectangular data table.

Data Collection Tool Read/Write Properties

Name Type Description Possible Values Default Value
columnsNamesInFirstRow boolean Whether the first row of the file contains names for the data columns. true,false true
delimiter String The delimiter character. "tab","space","comma","semicolon", or any single delimiter character "tab"
fileName String The name of the file to be read. Any string. ""
missingValueCode double A numeric value used to represent missing values in the file to be read. Any numeric value. -32768.0


Other Public Methods For Statistics Data Collection

Name Description Arguments Return Value
int getMaxRows() Gets the number of rows which were read. None. Number of rows.
int getMaxColumns() Gets the number of columns which were read. None. Number of columns.
boolean readData() Causes the data to be read and all listeners notified. None. true if data is read successfully
void setClipText(String Text) Supplies an actual string of data to be read. Any filename will be ignored. String of text with delimiters and carriage returns, as if read from a file. None.


Other properties needed for statistics data collection from files are inherited from the java.awt.Object class and from the general StatDataSource class.

Data Collection Tool Code Sample 

//create the FileDataSource bean 
FileDataSource fileDataSource1 = new FileDataSource(); 

//create a bean to display the data 
DataDisplayTable dataDisplayTable1 = new DataDisplayTable(); 

//set the filename to be read 
fileDataSource1.setFileName("c:\\statbeans\\samples\\cardata.txt"); 

//set the delimiter character used in the file 
fileDataSource1.setDelimiter("tab"); 

//make the data table a listener for changes in the fileDataSource bean 
fileDataSource1.addDataChangeListener(dataDisplayTable1.listenerForDataChange); 

//instruct the fileDataSource bean to read the file 
fileDataSource1.readData();