Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Measuring Bytes Transferred

 
mendoza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
does anybody have any idea on how to write java code that measures the number of bytes transferred in java programs? i am really trying to measure the amount of bytes being transferred when my mobile agents move from one location to another.
could someone kindly point me in the right direction.
many thanks in advance.
mendoza
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to JavaRanch! Please take a moment to read our display name policy, and modify your display name to include a first and last name. Thanks.
Next - does this have something to do with performance? I don't think so, so I 'm moving this to the I/O and Streams forum. Follow the link...
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand you correctly, probably the simplest way in general is to use a custom FilterOutputStream which keeps track of how many bytes have been written:
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim
What if i want to know the bytes transfered per second ?
[ August 11, 2002: Message edited by: raghav mathur ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can measure how much time has elapsed using System.currentTimeMillis().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic