aspose file tools*
The moose likes Java in General and the fly likes serializable not creating end of file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "serializable not creating end of file" Watch "serializable not creating end of file" New topic
Author

serializable not creating end of file

Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
Hi,
I've written a program wich wirtes a vector of custom objects and it works well, the problem is that when I read the file it creates, it never ends. If I try to open the file with vim it says, "no end of file" even the content is rigth, it doesn't have a end of line. Can anyone help me? Thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

On Windows, some kinds of files contain an actual end-of-file character, a Control-Z. If you're running vim on Windows, and vim thinks there ought to be such a character, then it may complain. But this doesn't mean anything. There's not supposed to be one in the file. It's vim that's wrong here.


[Jess in Action][AskingGoodQuestions]
Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
Ok, good to know, but it doesn't actually have an end of file, because when I invoke the read function, it never ends, it reads everything in the file, and instead of ending it tries to continue readind, producing an exception. This is what makes me believe the file doesn't have an end of file.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
When you crete the file in the first place, do you close() the ObjectOutputStream when you're done? If you don't, the object may still be alive, hoping to write more stuff. Be sure to explicitly close your streams (and really, anything else that has a close() function) which you're done with them.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: serializable not creating end of file
 
Similar Threads
reading -1 from file ?
How to detect the end of file
How to call a function located in another js file?
What does EOF mean?
One-to-One Hibernate\Spring , Child not inserted