The man who sets out to carry a cat by its tail learns something that will always be useful and which never will grow dim or doubtful.
-- Mark Twain
David Patrzeba wrote:Now I want to give my files their own extension and I want to make sure that the files can not be accessed except through the client program.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:- use Java's serialization mechanism. Just create a settings class that implements Serializable.
Jesper Young wrote:
Rob Prime wrote:- use Java's serialization mechanism. Just create a settings class that implements Serializable.
Using Java serialization for saving documents in files is a bad idea. Serialization is really not suited for long-term storage of data. That's because there is a very tight coupling (a one-to-one mapping) between your Java classes and the content of the serialized files. This means that if you change your program, then old serialized files become unreadable.
Serialization is fine for temporary storage (for example for caching objects) or for transporting objects through a network, but don't use it for storing for example documents.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
David Patrzeba wrote:Right now what I'm trying to learn is kind of like the best practices for saving files, and how to create unique extensions. It has nothing to do with me wanting to make a proprietary extension but rather would like to see how it is implemented and used. The other big thing is preventing my user from directly modifying their save files in a text editor and then corrupting there data, how do I work around that, do I just assume that my users won't open the file in Vi or notepad and mess with it?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
David Patrzeba wrote:The other big thing is preventing my user from directly modifying their save files in a text editor and then corrupting there data, how do I work around that, do I just assume that my users won't open the file in Vi or notepad and mess with it?