Hello. When we try to open a text file using the Data class we get a OutOfMemoryException. Due to this i've decided to implement a small integrity check on the data class. As the file size less the header length divided by the number of records should give us the record length, i've added the following code just before we create the array of field info.
Usualy when reading a text file, we get a huge number of fields, a huge header length and record count when compared with the file size. By making this comparison, when reading a text file we get values that are less than 1. Comments please. Thanks, Miguel
Hello Mark. I'm not trying to open a text file, it's just a integrity check for future users of the data class so that they will not try to do it. Thanks, Miguel
OK. Is that one of the requirements? And Doesn't the Data class constructor throw an IOException if something like this happens? Have fun. Mark
Miguel Roque
Ranch Hand
Joined: Oct 24, 2002
Posts: 126
posted
0
Hi. No, it's not a requirement. No it doesn't throw a IOException because when we try to read a text file we can get a number of fields with values bigger that 10000000! Can you imagine a array of FieldInfo like this? With this check, I'm just making the Data class more robust and more bullet prof! I don't belive that I will lost points due to this. Do you think I will? Thanks, Miguel
I don't belive that I will lost points due to this. Do you think I will? I can't answer that question. But I know I didn't lose points by not changing it. Mark
Miguel Roque
Ranch Hand
Joined: Oct 24, 2002
Posts: 126
posted
0
Hello Mark. Thanks for your help. I will keep the Data class with this small integrity check. I've read here some old post's of people that has done it. I'm about to finish the coding. I'me reviewing the design and reading the notes made on paper so that I can start to write my designs file. Best regards, Miguel