I don't want to Open a new thread , so I'd reather post my Question here aslong as it is related ..
when reading from a RAF .i found this exception
at java.io.RandomAccessFile.readInt(Unknown Source)
at HardwareRecord.readRecord(HardwareRecord.java:81)
at HardwareStoreInventory.getRecordFileandCheck(HardwareStoreInventory.java:33)
at HardwareStoreInventory.AddFile(HardwareStoreInventory.java:12)
at testerProg.RunOption(testerProg.java:66)
at testerProg.RunApplication(testerProg.java:18)
at Application.main(Application.java:19)
the line 81 is
setRecordnumber(datafile.readInt());
setToolName(StringModifierReader(datafile));
setQuantity(datafile.readInt());
setCost(datafile.readDouble());
and from a website it says that this Kind of exception when Occures with readInt() of the RAF
is usuallu because that it reached the eand of the file before 4 Bytes .. or something like that
but I have calculated the File length correctly
4 Bytes(Int)* 2(I have two)= 8
8Bytes(Double)*1 = 8 +
30Bytes(String of 15Chars)=30+
-------------------------------------------
the Total is 46
which will be the size of each file right ?
what do you people suggest me to do in order to handle the Exception ?
Thanks again