R
Roedy Green
I was considering converting a giant switch statement in my code to a
resource array lookup. Then I realised if anyone used my code, they
would have to MANUALLY ensure the resource were included in the jar.
They would fail to do so, and curse my code for not working.
What we need is something like a resource, but more tightly linked so
that it would be automatically be included in a jar, the way ANT
genjar automatically pulls in dependent class files.
Another way of looking at it, is we need a more efficient class file
format where you can include compressed data inside the class file for
initialisation.
There is a commercial product called Cramfull that does this, but you
can't very well use it in Open Source software. see
http://mindprod.com/jgloss/cramfull.html
We need something open source. You would use it like this:
HashMap<String,String h = (HashMap<String,String)
HolderClass.readResourceObject();
It would behave like readObject.
To prepare a resource you would do a writeObject to a *.ser file.
The prepare program would read it, gzip it, and somehow encode as a
giant string in a class file or some other more efficient format.
There are some tools for creating class files on the byte level. see
http://mindprod.com/jgloss/bcel.html
Any takers?
--
Roedy Green Canadian Mind Products
http://mindprod.com
Refactor early. If you procrastinate, you will have
even more code to adjust based on the faulty design.
..
resource array lookup. Then I realised if anyone used my code, they
would have to MANUALLY ensure the resource were included in the jar.
They would fail to do so, and curse my code for not working.
What we need is something like a resource, but more tightly linked so
that it would be automatically be included in a jar, the way ANT
genjar automatically pulls in dependent class files.
Another way of looking at it, is we need a more efficient class file
format where you can include compressed data inside the class file for
initialisation.
There is a commercial product called Cramfull that does this, but you
can't very well use it in Open Source software. see
http://mindprod.com/jgloss/cramfull.html
We need something open source. You would use it like this:
HashMap<String,String h = (HashMap<String,String)
HolderClass.readResourceObject();
It would behave like readObject.
To prepare a resource you would do a writeObject to a *.ser file.
The prepare program would read it, gzip it, and somehow encode as a
giant string in a class file or some other more efficient format.
There are some tools for creating class files on the byte level. see
http://mindprod.com/jgloss/bcel.html
Any takers?
--
Roedy Green Canadian Mind Products
http://mindprod.com
Refactor early. If you procrastinate, you will have
even more code to adjust based on the faulty design.
..