Sterling Moses wrote:
>
> Is there a quick and dirty way to read into memory (either String or
> StringBuffer) the contents of an .html file stored with a .jar or .zip.
>
> The java classes reading these files will be stored within the same .zip
> file. I need to read the .html files without really referencing the name of
> the zip or jar directly within code, for the name of the zip will change
> from distribution to distribution.
Use getResourceAsStream() to get an input stream for the HTML file,
read from that and write to a StringWriter or CharArrayWriter.
getResourceAsStream is a method of the class Class. Best bet is to use
a class that's sitting in the same directory in the zip file as the
HTML file. Then the argument to it is just "foo.html":
myObject.getClass().getResourceAsStream("foo.html")
if you have an instance, or
MyClass.class.getResourceAsStream("foo.html")
if you don't.
HTH,
Louis
--
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Louis Tribble [EMAIL PROTECTED]
Metamata, Inc. http://www.metamata.com
Tools for serious Java developers. +1 510 796 0915
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]