🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18854

MVC & Serialization

#18854
From: Satwant Bhumber
Date: Wed, 08 Apr 1998 00:00
20 lines
1112 bytes
I'm trying to write a program that will serialize the model to a file. The
code to load and save is located
within functions within the model.

Save seems to work fine

the following code:
      FileOutputStream fout = new FileOutputStream(filename);
      ObjectOutputStream out = new ObjectOutputStream(fout);
      out.writeObject(this);

But load doesn't like "this".
      FileInputStream fin = new FileInputStream(filename);
      ObjectInputStream in = new ObjectInputStream(fin);
      this = (LeagueSubject)in.readObject();
      in.close();

Does anyone know how to replace an object within it's own class?  (if that
makes any sence!)
Technical Details
Message-ID: <6ggrpu$r2m2@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,8e08f0b8337bbed4
X-Google-Attributes: gidf74b3,public
From: "Satwant Bhumber" <Satwant@btinternet.com>
Subject: MVC & Serialization
Date: 1998/04/08
Message-ID: <6ggrpu$r2m2@forums.borland.com>
X-Deja-AN: 342212347
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language