This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
How to check if file contents read matches what was written
John Vorwald
Ranch Hand
Joined: Sep 26, 2010
Posts: 139
posted
0
I would like to check if the data read from a file is the same as what was written.
Does the following example which calculating, saves, reads, recalculates, and compares the hash code accomplish the goal of making sure the data read matches the data written?
Is there a simpler solution?
And what's up with your naming conventions? Does an "f" in front of a name mean something or not? If so, what on earth does it mean? What's the "a" prefix, in things like "aAValue"? What's with the comments of "Read data from a binary file" on a method named "readBinaryFile"? And naming an ObjectInputStream aIsObject? It's all quite distracting.
So, my two questions would be these: (a) does it do what you want, and (b) how could it be simpler than writing, reading, and comparing?
David Newton wrote:And what's up with your naming conventions? Does an "f" in front of a name mean something or not? If so, what on earth does it mean? What's the "a" prefix, in things like "aAValue"?
That's how some people name their variables: f for fields, a for arguments, nothing for local variables. I find it highly distracting too.
Rob Prime wrote:That's how some people name their variables: f for fields, a for arguments, nothing for local variables. I find it highly distracting too.
It's not very consistent in the code above, which is one reason I asked.