Re: Java Expert Question
Re: Java Expert Question
- Subject: Re: Java Expert Question
- From: Steve Ehrenfried <email@hidden>
- Date: Sun, 14 Sep 2003 14:42:27 -0700 (PDT)
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.