Article View: borland.public.jbuilder.java.language
Article #8335Re: SERIALIZING an object containing a NON serializable object ?
From: Michiel Konstapel
Date: Sat, 31 Mar 2001 14:25
Date: Sat, 31 Mar 2001 14:25
19 lines
2160 bytes
2160 bytes
"Laurent Souriau" <lsouriau@club-internet.fr> wrote in message
news:9a2985$ks6$1@s1.read.news.oleane.net...
> > private transient BufferedReader data;
>
>
> Really ? I just got to do that ?
Sort of - marking the reference transient means this object simply won't be
serialized *at all*. When deserializing the object, data will be null. If
you can deal with that situation, then it'd be alright. One way to do this
may be to store, in something serializable, the info needed to rebuild the
BufferedReader (like a filename). Then, you could just use it like this:
if (data == null) {
data = new BufferedReader(new FileReader(storedFilename));
}
// use data as usual
HTH,
Michiel
Technical Details
Message-ID:
<pLlx6.23716$t9.2193056@news.soneraplaza.nl>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!dispose.news.demon.net!demon!skynet.be!newshub1.nl.home.com!news.nl.home.com!news-feed.nld.sonera.net!news.soneraplaza.nl!not-for-mailReferences:
<9a215a$fv4$1@s1.read.news.oleane.net> <3AC498C8.E5DBAD71@travelprice.com> <9a2985$ks6$1@s1.read.news.oleane.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,fb7796924622c37 X-Google-Attributes: gidf74b3,public X-Google-Thread: 10a146,fb7796924622c37 X-Google-Attributes: gid10a146,public X-Google-Thread: f631b,fb7796924622c37 X-Google-Attributes: gidf631b,public X-Google-ArrivalTime: 2001-03-31 06:24:04 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!dispose.news.demon.net!demon!skynet.be!newshub1.nl.home.com!news.nl.home.com!news-feed.nld.sonera.net!news.soneraplaza.nl!not-for-mail From: "Michiel Konstapel" <ask@me.nl> Newsgroups: borland.public.jbuilder.java.language,comp.lang.java.programmer,fr.comp.lang.java References: <9a215a$fv4$1@s1.read.news.oleane.net> <3AC498C8.E5DBAD71@travelprice.com> <9a2985$ks6$1@s1.read.news.oleane.net> Subject: Re: SERIALIZING an object containing a NON serializable object ? Lines: 21 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <pLlx6.23716$t9.2193056@news.soneraplaza.nl> Date: Sat, 31 Mar 2001 16:25:55 +0200 NNTP-Posting-Host: 212.127.144.52 X-Complaints-To: abuse@sonera.nl X-Trace: news.soneraplaza.nl 986048597 212.127.144.52 (Sat, 31 Mar 2001 16:23:17 MET DST) NNTP-Posting-Date: Sat, 31 Mar 2001 16:23:17 MET DST Organization: Sonera Plaza