On Fri, Feb 22, 2008 at 11:27 AM, Mike J. M. <[EMAIL PROTECTED]> wrote: > I just spotted this in the docs, and I was wondering how to use this class. > Is it even being used by any current classes? I want to limit the size of a > download either before or during downloading. My code right now simply > downloads the whole file and THEN check the size. But that wouldn't work > right because if someone tries to download a file that's 100 MB then it'll > download the whole 100 MB, or timeout, whichever comes first, and then check > the size. > What's the smart way to limit file download sizes, or maybe in this case > response body sizes in HttpClient?
I guess you want commons-io ThresholdingOutputStream: <http://commons.apache.org/io/api-release/org/apache/commons/io/output/ThresholdingOutputStream.html> Then use IOUtils.copy(InputStream,OutputStream) to read the data from method.getResponseBodyAsStream(). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
