aspose file tools*
The moose likes Distributed Java and the fly likes How can I know the transfering progress in RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "How can I know the transfering progress in RMI" Watch "How can I know the transfering progress in RMI" New topic
Author

How can I know the transfering progress in RMI

Jack Deng
Greenhorn

Joined: May 29, 2004
Posts: 23
I convert a large file to byte array on server side, and transfer it to client side. I want to build a progress indicator,can any one give me some advices, if you can provide sample code, it would be great. or I don't mind to use an alternative other than simply send the whole file's byte array to the client.

thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

The same way you'd do it with files. Define an RMI method that returns the amount of data that will be transferred and another RMI function that works like the C file fread/fwrite functions do in other to transfer the data in small chunks. That way, as the chunks come over you can easily calculate how much data remains and plot it on a progress bar and/or print a "% complete" message.

You couldn't do this if you attempted to transfer the entire data stream in a single method call, since from the application program's point of view, and RMI call is an atomic operation.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I know the transfering progress in RMI