Up to now I had to make a new file to hold the decrypted data, and I don’t want that. How can I not make a new file, but still read the decrypted data?
Thank you.
Up to now I had to make a new file to hold the decrypted data, and I don’t want that. How can I not make a new file, but still read the decrypted data?
Thank you.
ByteArrayOutputStream ?
Okay, so how do I wrap that into a java.util.zip.ZipFile? I really need it to be a zipfile, thank you.
Why don’t you google for answers. You’ll find the sourcecode and a proper explaination in less than 3 minutes.
I’ve already gone through google and sun forums =(
http://www.google.com/search?q=java+extract+zip+file
first result:
http://www.java-tips.org/java-se-tips/java.util.zip/how-to-extract-file-files-from-a-zip-file-3.html
See?
Combine that with the excelent advice Matzon gave you, and you’re ready to go.
Aww, that doesn’t use java.util.ZipFile
Oh no! Then you’re so stuck! Poor you.
If this is a homework assignment, ask your teacher.
Oh wait… instead of
http://www.google.com/search?q=java+extract+zip+file
you might try
http://www.google.com/search?q=java+extract+zipfile
And click on the first result:
http://www.devx.com/getHelpOn/10MinuteSolution/20447
See?
Combine that with the excelent advice Matzon gave you, and you’re ready to go.
If that doesn’t cut it for you, you might have to change your hobby, as this spoonfeeding is rediculous.
Okay, just one more problem…
ZipFile constructors don’t take an InputStream parameter, I can’t pass the decrypted data into the ZipFile constructor :-\
A ZipFile is based on a FILE, so it takes a File in its constructor, like the name suggests.
A ZipInputStream is based on an INPUTSTREAM, so it takes an InputStream in its constructor, like the name suggests.
You can’t use ZipFile and feed it an InputStream
You can’t use ZipInputStream and feed it a File
So what you want is NOT POSSIBLE.
Pick one, of the above, or pick a different hobby.
Ok I see, I’ll have to hack around it =/
Is it possible to get a file from a ZipInputStream? By giving it the name of the file I mean
Yay I figured it out =) I had to subclass ByteArrayOutputStream and add a name property.
Thanks Riven and Matzon!
Thanks for the support ;D
Oh well, it’s just silly how every trivial question gets its own thread with a code dump and a one line question. The replies are largely ignored, and a new thread is started when the next problem is stumbled on. If you’re so reliant on the community, and really can’t solve your own problems, then yes, a different hobby might result in actually getting something done.
Regarding the age… if he was 10, ok. But with 14 you should be able to do better.
Anyway, so much for spilling my annoyances.
STFU Riven, you’re acting like the GameDev.net assholes
This is the newbie board you know, so chill.
Lol, that community would rather see you fail than succeed.
Btw, why is Riven a guest?
If you’re trying to convert a outputstream into a inputstream that is a moderately complicated operation that requires a additional thread and a piped output/input streams combination.
You can combine this with the Executors to give your thread if you want some thread charactheristics (one thread per archive/execution whatever thread strategies, priority, cancelation (since pipedoutputstreams actually respond to interrups by throwing a Interrupted runtime exception - important - THE ONLY STREAMS IN THE STD LIBRARY THAT DO THIS -, etc)
What do you mean? I think that Javagaming.org doesn’t want to see you fail even though sometimes, some of us are a bit blunt (especially me and more than Riven). Personally, I want you to succeed. I began programming my first video game on a pocket calculator HP 48 GX in RPL when I was about 15, I had no computer, rarely access to internet and when I had a problem, I had to solve it by myself, it was difficult.
I believe he (or she?) was talking about gamedev.net. Both gamedev and forums.sun.com are very harsh environments for new/young/lazy programmers. Sarcasm, douchebagness and plain personal attacks are quite common.