UrlDataSource STATBEAN®


Purpose: Reads data from a file located at a specified URL and saves the results in an invisible rectangular data table. 

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"
missingValueCode double A numeric value used to represent missind values in the file to be read. Any numeric value. -32768.0
urlString String The URL of the file to be read. Any string. ""


Other Public Methods

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


Other properties are inherited from the java.awt.Object class and from the general StatDataSource class. 

Code Sample 

//create the UrlDataSource bean 
UrlDataSource urlDataSource1 = new UrlDataSource(); 

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

//set the url filename to be read 
urlDataSource1.setUrlString("http://www.statlets.com/data/commute.txt"); 

//set the delimiter character used in the file 
urlDataSource1.setDelimiter("space"); 

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

//instruct the urlDataSource bean to read the file 
urlDataSource1.readData();