Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: can Inflater be used to uncompress GZIP data?
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.


Report this thread to moderator Post Follow-up to this message
Old Post
chattycow
05-20-06 12:06 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:09 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.