Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / October 2003

Tip: Looking for answers? Try searching our database.

Streaming in serializable javabean

Thread view: 
m - 05 Oct 2003 06:19 GMT
Hi all,

I am trying to build a serializable javabean.
What can I do with inputstream? Should I always read the whole stream and
put that into a byte[] attribute? This doesn't seem a good solution.
What else could I do?
Thanks.

m
John C. Bollinger - 09 Oct 2003 17:17 GMT
> I am trying to build a serializable javabean.
> What can I do with inputstream? Should I always read the whole stream and
> put that into a byte[] attribute? This doesn't seem a good solution.
> What else could I do?

It depends on the role your stream plays in the bean.  The main options
I see are to serialize all the stream's data with the bean (you
mentioned the easiest way to do that) or to instead serialize the data
necessary to open and position a new stream when the bean is
deserialized.  The former is inelegant, and swells the serialized
representation of the bean; the latter is problematic if the required
resource is not available at deserialization time.

My recommended solution is to not make beans that contain references to
stream objects.  (Bean methods may manipulate any objects to which they
are given references, however.)

John Bollinger
jobollin@indiana.edu


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.