aspose file tools*
The moose likes Java in General and the fly likes whats with foo.ser? (in regarrds with serialization) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "whats with foo.ser? (in regarrds with serialization) " Watch "whats with foo.ser? (in regarrds with serialization) " New topic
Author

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

Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1056

FileOutputStream fs=new FileOutputStream("foo.ser");


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


cant we use .txt ,.docx etc


http://www.lifesbizzare.blogspot.com || OCJP:81%
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
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
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: whats with foo.ser? (in regarrds with serialization)