I'm using Apache-Commons and downloading file content. Everything works perfectly, but I want to add a progress indicator for which I need the incoming file's content length.
In my debugger I can see that my InputStream
has an object labled 'in' of type ContentLengthInputStream
, and one of this object's properties is, in fact, the length of the file! However, I don't see a way to get TO that object in my code. InputStream doesn't have all that many methods and none of them get at this inner Object or pull any values from it.
Is there some alternate way to get to this header? I can see that the data is in there, but I'm stumped as to how to access it.
In case it's useful, here's a snippet of the call...
HttpClient client = new HttpClient();
filePost = new PostMethod(URL_PATH);
InputStream ret ;
responseCode = client.executeMethod(filePost);
ret = filePost.getResponseBodyAsStream();