Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Serialisation to textbased formats

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hiho
Does exist a possibility to serialize to a textbased format like .ini, config-files or XML-files?
Ciao, J�rgen
 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's easy to serialize objects to files using a FileOutputStream and ObjectOutputStream. Those files look like a lot of gibberish, though, with some text in them. Does your file have to look like a clean text file?

Originally posted by J�rgen Kosche:
Hiho
Does exist a possibility to serialize to a textbased format like .ini, config-files or XML-files?
Ciao, J�rgen


 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I'm looking for a clean text-file-format. The problem with ObjectOutputStream is, that an change in the classfile does change the format of the serialized file. With an textformat this could be avoided.
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only way I've been able to do this in the past is by *not* serializing objects, interpreting the essential data they contain as text, and writing that text to a file. This gives you a clean, formatted text file. When you read the file you create new objects of whatever type they are, and assign them the values specified in the text file.
If you figure out a better way, I'd love to hear it!

Originally posted by J�rgen Kosche:
Yes, I'm looking for a clean text-file-format. The problem with ObjectOutputStream is, that an change in the classfile does change the format of the serialized file. With an textformat this could be avoided.


 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic