Re: Java Expert Question
Re: Java Expert Question
- Subject: Re: Java Expert Question
- From: Matis Schotte <email@hidden>
- Date: Mon, 15 Sep 2003 16:15:11 +0200
hi,
i have it fixed with a subclass from filterinputstream and named
countinginputstream, and then i count the bytes ...
see:
http://forum.java.sun.com/thread.jsp?
forum=31&thread=444517&start=0&range=15#2008504
thxc!
- smat
Am 14.09.2003 um 23:42 schrieb Steve Ehrenfried:
One option is read in the input in bytes instead of
objects, if you can do it. If not, another option
would be to cast each object to its actual type (which
you should know if you're reading the input as
objects), and then get the size/length of it, e.g.:
String aString = (String) ois.readObject();
int bytesRead = aString.length();
However, to do a progress accurately while reading
objects instead of bytes, you'd need to know in
advance how many bytes are in the stream, and I don't
know if there's a way to do this in Java. Perhaps when
you write out objects, the first object in the stream
could be the size of the other objects. Haven't tried
this though.
-Steve
--- Matis Schotte <email@hidden> wrote:
hi,
how can i detect/write out how many bytes are
received when i use
readObject() from class ObjectInputStream ...?
i must do this for a progressbar ...
when i write this function to receive only 1 byte,
then the next, the
next, ..., it is very, very slow ... :(
thx ...
- smat
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.