The error that I get is
Unhandled exception type IOException
But can't thing of a way to fix it. The file and address are valid
If anyone has any ideas they would be appreciated. Below please find offending code
Thanks
Simon
package StatPairsModel;
public class Engine {
public static void main(String[] arguments) {
//**The next line has the offending error**
DataAccess rawStockData = new DataAccess("c:\\Beg Java Stuff\\SGC1.txt");
Timeseries[] myTimeseries = new Timeseries[4];
Stock stock1 = new Stock();
Stock stock2 = new Stock();
int numberOfPairs = 3;
int[] myId = { 1, 2, 3, 4 };
int[] myDate = { 37795, 37796, 37797, 37798 };
double[] myClose_price_euro = { 1.23, 1.26, 1.25, 1.30 };
double[] myClose_volume = { 2.321, 2.325, 2.365, 4.321 };
double[] myClose_market_cap = { 3.21, 3.21, 3.21, 3.22 };
int[] myCorp_action_ind = { 0, 1, 0, 0 };
double[] myBeta = { 1.21, 1.32, 1.51, 1.21 };
double[] myClose_price_local = { 2.23, 2.26, 2.25, 2.30 };
// for (int i = 0; i<numberOfPairs; i++){
stock1.setStock("0015425", "Vodafone", "VOD LN", "UK", "TELECOM",
"GBP", "VOD LN", "FTSE");
stock2.setStock("0045125", "Telecom Italia", "TIM IM", "IT", "TELECOM",
"EUR", "TIM IM", "MIB");
int i=0;
for ( i = 0; i < myTimeseries.length; i++) {
myTimeseries[i] = new Timeseries();
myTimeseries[i].setTimeseries(myId, myDate, myClose_price_euro,
myClose_volume, myClose_market_cap, myCorp_action_ind,
myBeta, myClose_price_local);
//System.out.println(myTimeseries[i].getId(myId));
//System.out.println(myTimeseries.length);
myTimeseries[i].display(i);
}
//stock1.setMnemonic("123456");
//stock1.display();
//System.out.println();
//stock2.display();
}
}
package StatPairsModel;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Vector;
import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.Enumeration;
public class DataAccess {
String thisLine;
String address;
int dataPointCount = 0;
DataAccess(String address) throws IOException {
{
try {
FileReader file = new FileReader(address);
BufferedReader buff = new BufferedReader(file);
int dateKeyField = 0;
int tickerKeyField = 0;
String keyField = "";
boolean eof = false;
while ((thisLine = buff.readLine()) != null && !eof) {
StringTokenizer st = new StringTokenizer(thisLine, ",");
while (st.hasMoreElements()) {
}
}
System.out.println("dataPointCount " + dataPointCount);
System.out.println("address " + address);
}
catch (IOException e) {
System.out.println("Error -- " + e.toString());
}
}
}
void process() {
System.out.println("Processing....");
}
}

New Topic/Question
Reply




MultiQuote




|