• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

whats with foo.ser? (in regarrds with serialization)

 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FileOutputStream fs=new FileOutputStream("foo.ser");


is it cumpolsary to use only one extension that is .ser ?


cant we use .txt ,.docx etc
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The file system does not impose any naming constraint when creating. You would not want to use something that Windows associates with a particular program.

Personally I use .ser or something similar so I can recognize where a file came from.

Bill
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:cant we use .txt ,.docx etc


Technically you can, but as William said Windows will not see that the file is not a text file or Word 2007 file. Therefore, double clicking the file will have Windows open the file with Notepad (or any other editor that is configured to open .txt files) or Word 2007. These programs can't properly display these files.

.ser is often used for files containing serialized objects, both because it makes it a bit clearer what the file contains and because .ser is not an extension used by popular applications. If you want you can use .vishal or any other thing you like. I usually use no extension at all.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:FileOutputStream fs=new FileOutputStream("foo.ser");
is it cumpolsary to use only one extension that is .ser ?
cant we use .txt ,.docx etc


What happened when you tried it?
 
reply
    Bookmark Topic Watch Topic
  • New Topic