• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Java Expert Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Java Expert Question
      • From: Matis Schotte <email@hidden>
References: 
 >Java Expert Question (From: Matis Schotte <email@hidden>)

  • Prev by Date: Loading a bundle from memory
  • Next by Date: Re: NSOpenPanel and the New Folder button
  • Previous by thread: Java Expert Question
  • Next by thread: Re: Java Expert Question
  • Index(es):
    • Date
    • Thread