Code Comments
Programming Forum and web based access to our favorite programming groups.The data is comming from a socket/network inputstream delivered to me ~32K at a time. No doubt pipedinput/output streams are an option. However, there is a few limitations with pipeinput/output streams...namely the static 1K buffer, the need to connect them, 2 classes as apposed to 1, and any other overhead associated with these...I'm sure there are more though. What I wrote is a very simply extension of inputstream and outputstream (~300 lines..w/ comments) connected by a single bytebuffer array. I write blocks(32K at a time) to the output stream (that I extended). In another thread, I connect the GZIPInputStream to the inputstream(I extended) and start to uncompress. SequenceInputStream is fine if you already have all your streams identified, but I don't have all the data yet and I can't put it all in memory. SequenceInputStream will combine all the streams that you tell it, but it can't combine streams on the fly as you add them so it doesn't help. There are two features I'm trying to get: 1) The socket connection is also being used for general communication before and after the gzip file is transfered to transmit other items, informational messages, etc.. If I give the socket stream over to GZIPInputStream, when it completes it will close the entire connection. In addition, GZIPInputStream doesn't know it's done until it reads a "-1" from the inputstream...it assumes it's reading from a file connected to an input stream. 2) I want to be able to give a status of the file download while it's downloading via another monitoring thread. As far as I know, you can't do that with a stream that your already using for something else....so every 32K, I check to make sure the data is OK and count how much I've sent/received, how fast, etc. I'm sure everything I just said brought up a lot more questions? I posted back because I wanted others to see what my solution was so that they might have an answer when they come accross the same problem. In any case, the problem is solved. Thanks again, ----Dean.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.