Joanne
Joanne Neal wrote:Before parsing the line, check if there's any data in it.
Chuck Barnes wrote:
Joanne Neal wrote:Before parsing the line, check if there's any data in it.
sounds like it would work. But, would there be a performance hit? It would run on every line and I am talking about just over 200k records across 5 files.
As it stands the only extra code is the two instances of the exception being caught.
Joanne
Mwaaahaahaahaa!Ove Lindström wrote:. . . the curse of Campbell upon you, . . .
Campbell Ritchie wrote:
Mwaaahaahaahaa!Ove Lindström wrote:. . . the curse of Campbell upon you, . . .
How did you implement your tail program?
Would it be possible to read the entire file into a List<String> and iterate the List backwards removing items until a non-empty String is found? That would depend on it memory footprint, I would presume.
Campbell Ritchie wrote:That tail implementation seems to use a random access file. Can you convert a CSV to random access?
At this point, we are beyond the “beginning” stage, so I shall move this discussion.
Ove Lindström wrote:
You can convert any file to a random access. I still think that this is a Parser pattern problem and should be treated as such. Create a factory that can handle a line and parse it from there. Return an object if parsing was ok or a null-implementation of that objects interface if not. Or throw an exception. But I am not that fond out using exceptions to control flows.
Chuck Barnes wrote:
Ove Lindström wrote:
You can convert any file to a random access. I still think that this is a Parser pattern problem and should be treated as such. Create a factory that can handle a line and parse it from there. Return an object if parsing was ok or a null-implementation of that objects interface if not. Or throw an exception. But I am not that fond out using exceptions to control flows.
I think I'll try that idea. I was wondering if you could point me in the direction of an example of a factory that you refer too? Im not sure I know the concept of what a 'factory' is.
Thanks for the help