Language: Java
OS: Windows XP
My Java knowledge: Learning/Low
I need to read a structured file(Hist.dat) which written using Visual Basic.
Visual Basic Structure is
Type Histx
Units(380) As Single ' Single is equal to float in java, 4 bytes
Sell(380) As Single
Cost(380) As Single
Prom(380) As Integer ' Integer is equal to short in java, 2bytes
End Type
so each record is (381 X 4) X 3 + 381 X 2 bytes , = 5334 bytes
it can be 100 000 records in a file. 5334 X 100 000 = 508.7 Mb
File Structure(a= first record, b= second record, n= nth record)
Ua1....Ua381 Sa1......Sa381 Ca1....Ca381 Pa1.....Pa381 Ub1....Ub381 Sb1......Sb381 Cb1....Cb381 Pb1.....Pb381 ..........................
..........
..Un1....U
n381 Sn1......Sn381 Cn1....Cn381 Pn1.....Pn381
Ua1 = 4bytes representing first element of Unites in first record.
Pb381 = 2bytes repesenting last element of Prom in second record. and so on.
You can download a sample Hist File from
http://www.postecsolutions.com.au/EE/HisD5.zip (25KB)
Attention.
Keep in mind Hist.dat file can be 1Mb to 500 Mb.
Speed mabe a issue.
Is it possible to read a structured file written using VB by java? I assume it can be done.
__________________________
__________
__________
__________
__
QUESTION:
I want to read this data from Hist.dat and write to comma seperated file as numbers. How can we do this? Whats the best way to read data from file? Please answer with a Full Working Example.
__________________________
__________
__________
__________
__
Post Notes: I need a realy realy smart programmer to Answer this question. I post this question earlier and I didnt get the desired answer. I spend more than 10 days googling a answer. So kind frustrated now.
Please Please Help, Udana
To read float, call nextFloat()