File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Measuring Bytes Transferred Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Measuring Bytes Transferred" Watch "Measuring Bytes Transferred" New topic
Author

Measuring Bytes Transferred

mendoza
Greenhorn

Joined: Jul 26, 2002
Posts: 2
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

Joined: Jan 30, 2000
Posts: 18671
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...


"I'm not back." - Bill Harding, Twister
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
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

Joined: Jan 12, 2001
Posts: 641
Jim
What if i want to know the bytes transfered per second ?
[ August 11, 2002: Message edited by: raghav mathur ]

Raghav.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
You can measure how much time has elapsed using System.currentTimeMillis().
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Measuring Bytes Transferred