PDA

View Full Version : binary and text input methods


philski5
10-10-2002, 04:29 AM
:sick:
Hi guys I have sort of got an explanation for this, but some info on how to do the special return mentioned would be good... however the below gives a little intro into a program design issue I am worried about....

"Hi, needing assistance. Firstly, my question is if I can put a return statement into a catch block. I am writing an assignment that inputs a binary file, and needs to process blocks of input in the file (ie read and save 6 lines of the file, save each of the lines in separate variables, then call tests for this block of code before it is saved) until there are no blocks of code left.
Instead of testing the last line of input in a while loop, I thought "F&C a catch for an EOFException might be good" so I am thinking I will do that. I need a return because after I have processed all the blocks of input, there are a few other tasks I have to do... which now that i think of it will mean i need to also research those return statements that go to certain places. Anyway, advise about the return statement, or the new one I will be wanting will be much appreciated.
Thanks heaps, Cozmos"

The design problem is that my program need to input files of both binary and text format, and my simple experience means the readers will be dataInputStream and bufferedReaders respectively. However, because i need to test the blocks of input and store them as I go, I am going to end up with two methods that do pretty much the same thing (processing is the same for both file formats), except one processed with dataInputStream and one using bufferedReader.
I am sort of clutching at straws, and besides you guys knowing the situation and being able to write me a good algorithm... you might not be able to help...

but do you think that wat I just wrote about having two alrgorithms that pretty much do the same thing is really dodgy?
Thanks, Phil

philski5
10-10-2002, 04:36 AM
also this might need to be added to make it clear,
one of the reasons I need to have two methods, one to process and test each file format is because of the need to test each block of input in the "inputFile"... then have a loop that inputs the next block of values (in the same format) (ie tfn=..., yearTaxReturn=....,~~~test~~store..."loop" tfn=...., yearTaxReturn=....,~~~test~~~~store...."loop"....until end of file). I hate this process,
Thanks for any help offered. Cozmos