The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message: Type code out of range, is -84

Posted by Istvan Bagyura on December 05, 2001 at 6:33 AM


I've wrote a class that implements Serializable interface and I have a problem with that.

I can write these serialized objects to a file with ObjectOutputStream,
but I can't read these objects from the file.

The code I write to a file with /it works properly/:

private void kiir( TreeObject to )
throws FileNotFoundException, IOException
FileOutputStream fout = new FileOutputStream
ObjectOutputStream oout = new ObjectOutputStream(fout) ;

oout.writeObject( to );
oout.flush() ;

The code I read from a file with /it doesn't work properly/:

public void list()
throws Exception
FileInputStream fin = new FileInputStream( this.SOURCEFILENAME ) ;
ObjectInputStream oin = new ObjectInputStream( fin ) ;

TreeObject to ;

while ( ( to = (TreeObject) oin.readObject() ) != null )
System.out.println( to.toString() );

oin.close() ;

What can I do? There is something I don't know?

Thanks All!



Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us