• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I know the transfering progress in RMI

 
Jack Deng
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic