AFAIK there is no magic in having a java program write out a file with any extension or contents.
The magic is getting a unique value for the extension and having the OS recognize it as belonging to your application. For example 12 years ago I used the RSS extension for my slideshow control file.
On MS windows, the connection between an extension and an application is via the registry.
On linux there is a table somewhere that needs to have an entry.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
Can anyone tell me about how to create my own format like .azw(kindle device format),.mobi,.epub etc..Is it possible to create it using java? if yes then what are the steps to do that? I am doing project for e-publishing company they need one own proprietary format like the above formats for their company. To accomplish this task, what are the things i have to learn or what details i have collect to do this?I planned to do this in java.Is it right platform to do that?
please help me and share your ideas..
Thanks in advance..
Hmm would this not depend on the type of OS such as Windows,Linix etc? Because I don't think java has an inbuilt file extension api. In windows one might use command prompt and regedit for example to make our application open a certain type of file ie *.cg
DavidKroukamp
Practically a Master Poster
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
NormR1 is right, just creating a file with a certain extension can be done easily like
File myFile = new File("testfile.qrr");
boolean created = myFile.createNewFile();
but it would be nothing more than a txt file with a different extension. it'll take more than just to change the extension to make the data be stored or handled differently.
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
that doesn't really matter here.
when the contents is decrypted, the nature of the file itself doesn't really change. if it was created as a .txt with alternative file-extension, whether you encrypt the contents or not, the OS would still regard it as a txt file.
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433