On Fri, Jun 13, 2008 at 11:29 AM, Sabarivasan Viswanathan
<[EMAIL PROTECTED]> wrote:
> I will be doing a simple POST request to download a large file (of the order
> of a few tens of megabytes).
>
> In order to ensure that the file is not corrupted during transmission, I
> want to do a checksum on the client and compare it with the server's.
>
> This seems like a very common thing to do. Is this already supported as part
> of HttpClient?

No, but it is part of Java 1.4.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/CheckedInputStream.html

CheckedInputStream cis = new CheckedInputStream(
getMethod.getResponseBodyAsStream(), new CRC32() );

// stuff

long sum = cis.getChecksum().getValue();

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to