Hi, hope this is the right forum to post this. I'm transfering a file through a servlet, it's a zip file and I want to know if I can check the integrity of the zip before I try to send it (I'm extracting it from documentum) and when I've received it. Last part is easy I've just got to send the CRC string. Is it possible to check before sending it (without opening it)? Thanks
Don't ever let your computer know you're in a hurry! :nono:
Is it possible to check before sending it (without opening it)? Depends what you mean by "without opening it". If you mean, without a human being double clicking on the file to open it, then yes. If you mean, without having some sort of process do something to read the contents of the file, then no. To see if the contents of the file are OK, something, somewhere, would need to look at the file. Why? Seems to me that "garbage in, garbage out" should apply. Well it may be useful to know at what point in the process it was garbage. If the client receives a bad file, was it bad to begin with, or is there some flaw in the client or servlet which corrupts the data? To check integrity, I would probaby create a ZipFile and loop through all the entries, see if an exception is thrown. If you've got enough free time on the server, get the input stream for each entry and read the entire contents. If no error is thrown, the integrity is probably OK.
"I'm not back." - Bill Harding, Twister
Joined: Jan 29, 2003
Obviously I mean somebody clicking. I'm going to start working with this: public class CheckedInputStream extends FilterInputStream An input stream that also maintains a checksum of the data being read. The checksum can then be used to verify the integrity of the input data. Might be the answer......I hope, thanks 2 u all, again.