reading a .dat file

hey,

i have several dat files i want to read in. the files all contain different kind of types like int, double, strings ... it looks kind of like that:

10.001.2223.33test1

28.002.0034.00test2

..............

so its like a matrix. i know how to read a file and everything. i was just wondering if anybody has a good idea to read the lines in and store it in a matrix or something. or what would be the best way to read it in and store it?!

[475 byte] By [izziieea] at [2007-11-27 0:54:36]
# 1

I would:

1) Iterate through entire lines and keep track of the lines with a variable

2) create the matrix

Object[][] data = new Object[numOfLines][5];

3) Use a nested for loop to iterate through all the data and add it to the matrix

for(int r)

for(int c)

data[r][c] = data.next();

lethalwirea at 2007-7-11 23:27:02 > top of Java-index,Java Essentials,Java Programming...
# 2
thanks for the reply lethalwire!funny...thats exactly what i decided to do.... :)
izziieea at 2007-7-11 23:27:02 > top of Java-index,Java Essentials,Java Programming...