Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

serializable not creating end of file  RSS feed

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Sheriff
Posts: 24220
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!