Renoria
|
 |
«
Posted
2008-12-27 11:50:52 » |
|
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.
|
|
|
|
|
hishadow
Senior Newbie 
|
 |
«
Reply #1 - Posted
2008-12-27 15:48:54 » |
|
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.  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
|
|
|
|
|
oNyx
|
 |
«
Reply #2 - Posted
2008-12-27 22:09:46 » |
|
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.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Renoria
|
 |
«
Reply #3 - Posted
2008-12-28 03:43:55 » |
|
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.
|
|
|
|
|
i30817
|
 |
«
Reply #4 - Posted
2008-12-28 04:20:01 » |
|
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)
|
|
|
|
|
Renoria
|
 |
«
Reply #5 - Posted
2008-12-28 04:49:49 » |
|
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?
|
|
|
|
|
Renoria
|
 |
«
Reply #6 - Posted
2008-12-29 07:55:15 » |
|
OMG, I just tried LZMA for java and encrypting a 1kb file gives a OutOfMemoryError.
|
|
|
|
|
hishadow
Senior Newbie 
|
 |
«
Reply #7 - Posted
2008-12-29 09:11:23 » |
|
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  , 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).
|
|
|
|
|
Renoria
|
 |
«
Reply #8 - Posted
2008-12-29 11:49:52 » |
|
If I use ZIP, is there a way I can maybe add some extra bytes to annoy hackers which try to extract it?
|
|
|
|
|
SimonH
|
 |
«
Reply #9 - Posted
2008-12-29 12:30:13 » |
|
Why not use zip/jar but encrypt the data with the javax.crypto package?
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Renoria
|
 |
«
Reply #10 - Posted
2008-12-29 12:34:52 » |
|
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....
|
|
|
|
|
SimonH
|
 |
«
Reply #11 - Posted
2008-12-29 13:38:15 » |
|
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...
|
|
|
|
Renoria
|
 |
«
Reply #12 - Posted
2008-12-29 13:42:48 » |
|
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
|
|
|
|
|
Riven
|
 |
«
Reply #13 - Posted
2008-12-29 15:48:25 » |
|
new ZipInputStream(InputStream); 
|
|
|
|
Renoria
|
 |
«
Reply #14 - Posted
2008-12-29 15:52:54 » |
|
Oh, thanks Riven  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.
|
|
|
|
|
|