Well I've been able to get a ProgressMonitorInputStream working with
GetMethod. I can now get a ProgressMonitor to pop up for my
downloads. I've had to wrap the InputStream returned from
getResponseBodyAsStream() with a FilterInputStream that returns the
contentLength for available(). I also had to extend GetMethod to make
getResponseContentLength() public. Why is it protected?? This is
kind of ugly, but it works.
/**
* supply a hard-coded value for available() method.
*/
class FixedInputStream extends FilterInputStream {
private int contentLength;
public FixedInputStream(InputStream is,
int contentLength) {
super(is);
this.contentLength = contentLength;
}
public int available() throws IOException {
return contentLength;
}
}
/**
* expose protected method getResponseContentLength.
*/
class FixedGetMethod extends GetMethod {
public FixedGetMethod(String url) {
super(url);
}
public int getResponseContentLength() {
return super.getResponseContentLength();
}
}
--
George Armhold
Rutgers University
eLearning Grant, DCIS
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]