I don't think that the library provides this kind of feedback (how much data has been transferred) to the client application.
A workaround might be to write a wrapper for the InputStream class that keeps track of how many bytes have been read (by overriding the various read methods), but otherwise passes all calls directly through to the underlying stream. You could then pass that wrapper to the storeFile method. [ October 03, 2008: Message edited by: Ulf Dittmer ]
But if you use ProgressMonitorInputStream, you can use FTPClient's storeFileStream method, and do the copying manually.
Actually, ProgressMonitorInputStream does exactly what you suggest. For example, the read(byte) method:
Edit: wait a sec. Why do the copying yourself? FTPClient's storeFile method takes an InputStream already. Just use the ProgressMonitorInputStream instead of the FileInputStream. [ October 03, 2008: Message edited by: Rob Prime ]
Joined: Mar 22, 2005
Cool! I never knew about that class. Yes, it implements precisely what I had in mind.
What if you don't have a gui component to your program? As far as I can tell, the ProgressMonitorInputStream pops up a dialog displaying the progress. I just want to know what the progress is so I can occasionally update my logs.
Is there an automatic way to do this, or do I have to create my own InputStream implementation?