Reading a 7z archive?

Is there a way to read a 7z archive with a 3rd party lib or something?

I read about it http://www.7-zip.org/sdk.html << There but it doesn’t tell me enough information.

Thanks.

That (for the java code included) only gives you the ability to pack/unpack a single file with lzma. Handling the 7z archive format need additional code. The format is described though in 7zFormat.txt if you want to do it yourself. :slight_smile:

ed: an easier way is to: your files -> uncompressed jar/zip -> lzma pack -> include in your program -> unpack lzma -> handle further as ordinary jar/zip

7z isn’t suited to be directly used by games, since accessing individual files is rather slow. However, LZMA is great for installers or downloaded resources.

MapleStory uses 7z.

I’d be interrested in using a simple 7z api - something like the jdk zipfile with the List getHeaders() and name, date, CRC32, etc functions. But it’s only for completness sake, for me, since there is now a java rar api (junrar)

I would probably like the 7z archiver because its not that popular, therefore it is harder to hack?

OMG, I just tried LZMA for java and encrypting a 1kb file gives a OutOfMemoryError.

Now, I’m not sure about encrypting with LZMA is a good thing :D, but LZMA compression/decompression uses alot of memory. That’s the price you pay for better compression ratio. You can to some degree control the memory usage by experimenting with the compression parameters (which control the size of the dictionary used by LZMA during decompression).

If I use ZIP, is there a way I can maybe add some extra bytes to annoy hackers which try to extract it?

Why not use zip/jar but encrypt the data with the javax.crypto package?

can you get me some Java Docs/Tutorials for this? xD

Also, don’t all users who use this need the Unlimited Strength Cryptography extension in their JDK? Just wondering…

Java doc here. javax.crypto is a standard part of J2SE - I’ve never tried it but it should work anywhere…

Okay I can encrypt it, but java.util.zip constructors are either File or String so how do I read it? With fileinputstream I mean

new ZipInputStream(InputStream); :persecutioncomplex:

Oh, thanks Riven :wink:

EDIT:

Is there a way to modify files under C:/Program Files/Java/jre-whatever/?

I need this to replace their files with the JCE extension.