Programming => General Java Game Development => Topic started by: imagenesis on November 26, 2008, 17:28:43

Title: A little help with LZMA library...
Post by: imagenesis on November 26, 2008, 17:28:43
Hey, looking for a little help with the lzma library seeing as how lwjgl uses it and I couldn't find any support anywhere else (and I first heard of it here ;]). I've looked at the examples and the files and as far as I can tell, it doesn't provide a way to unarchive a file. I mean it doesnt provide a way to compress a set of files/directories and then retrieve them, rather it just provides the compress method. It's not that big of a deal, just wnat to confirm this. If so, I think I'm just going to first zip up my files and the lzma them seeing as how creating a new archive meta format and API doesn't make much sense... is this what you guys are doing?
Title: Re: A little help with LZMA library...
Post by: Matzon on November 26, 2008, 19:06:33
extractLZMA in http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java?revision=3115&view=markup

we use reflection to avoid hard dependency
Title: Re: A little help with LZMA library...
Post by: imagenesis on November 27, 2008, 05:22:41
Hey thanks for the link! :D

I am however having a problem with the SDK in general. :( I am using an Applet as a preloader so the LZMA uncompression needs to in theory work in a 60-90mb heap...

java.lang.OutOfMemoryError: Java heap space
at SevenZip.Compression.LZ.OutWindow.Create(OutWindow.java:18)
at SevenZip.Compression.LZMA.Decoder.SetDictionarySize(Decoder.java:162)
at SevenZip.Compression.LZMA.Decoder.SetDecoderProperties(Decoder.java:327)
at shared.utils.Utils.lzmaUncompress(Utils.java:118)
at common.Preloader.download(Preloader.java:164)
at common.Preloader.redownload(Preloader.java:131)
at common.Preloader.init(Preloader.java:58)
at sun.applet.AppletPanel.run(AppletPanel.java:380)
at java.lang.Thread.run(Thread.java:595)

I am getting the above message when attempting to decompress a file. The file is very small (uncompressed 128 bytes, compressed 191). In anycase, I have compressed the file on every posible setting using the 7zip program including the very lowest quality compression.

Anyway, I think I have a solution but again need a little help! (Sorry for using this as a general Java help forum, heh, but I know you're good at what you do!):

I have heard that it is posible to use the Applet to issue a native shell-like call (ie PHP equivalent of exec()?).

I could download the files with the Applet, and start the decompresser as a seperate program and then wait for it to finish before continuing no?

What package would be used for this, and any advice?
Title: Re: A little help with LZMA library...
Post by: Matzon on November 27, 2008, 06:17:20
I have no experience with the 7z api - just the lzma inputstream, which works for our needs.
if you are using java 6 update 10, I believe you can specify a heap argument somehow.

for executing processes, you need to use java.lang.Process.