Re: Incorporating data files into packages and accessing internally
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 20:59:19 GMT
On Tue, 31 Jul 2007 13:42:56 -0700, Todd <todd.heidenthal@xxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
Furthermore, I would like to be able to open and read the contents of
the data files within the package without having to know its path on
the disk. I would like to think that I can access a data file within
a package in a manner similar to accessing another class in the
package. If so, how do I do this?
there are several ways to skin that cat.
1. put the data in resource, usually gzipped in the jar. See
http://mindprod.com/jgloss/ant.html
http://mindprod.com/jgloss/genjar.html
http://mindprod.com/jgloss/resource.html
http://mindprod.com/jgloss/image.html
This is the usual way. Have a look at:
http://mindprod.com/products1.html#BIO includes two images in the jar
as resources.
http://mindprod.com/products1.html#HOLIDAYS includes a text properties
file in the jar.
2. massage the data so it looks like java source code, eg. an array
initialisation, a long hex string, and insert it into a class file.
I do this with http://mindprod.com/products.html#ENTITY
3. Use Cramfull. http://mindprod.com/jgloss/cramfull.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- References:
- Prev by Date: Re: Incorporating data files into packages and accessing internally
- Previous by thread: Re: Incorporating data files into packages and accessing internally
- Index(es):
Relevant Pages
|