In short, I have a package that can load a proprietary device file-format. The underlying reading code is written in Java, packed into
.jar, and in a Mathematica package, I can use some simple
JLink wrapper functions to access the functionality.
Now, I would like to attach my code to Mathematica's
Import, which is usually also trivial by employing
ImportExport`RegisterImport. However, to make the importer always available, the
RegisterImport code is should be placed in
For simplicity, assume the following fake package structure
│ └── reader.jar
│ └── init.m
ReadingFunctions.m, I'm accessing the Java methods from the
jar and provide high-level Mathematica functions for the binary file format. In
Import.m I can use these functions and register a custom importer.
My questions are simple:
- How can I set-up the
PacletInfo.mso that the
Import.mgoes into the
Formatsdirectory and automatically loads the rest of the package when I try to import files?
- Or should I use
Loading -> "Startup"in the
PacletInfo.mto make it available on a kernel start? But then, some unnecessary is always evaluated (e.g. loading of the
jar) that I only need if I indeed use the importer in a session.
Are there other/better ways I haven't considered? I could start testing around, but my hope is that someone can give some hints.
Bonus: Do we have a better alternative to this here for adding a file-extension so that it is automatically recognized by