I'll take a stab...
You want to compress the input stream coming in and pass it along as an InputStream? I'm thinking of something like a stream filter. Look at the piped I/O stream classes. Maybe you can construct a ZipOutputStream around a piped outputstream that's connect to a piped input stream that you pass along. The problem here is you get into Threads because you would want to write or convert the original InputStream in a separate
thread that you start and then pass the piped input stream along.
That's off of my head and there are some problems with the code no doubt. For one you'd have to know who's responsible for flushing and closing the streams. But the basic idea is you put the logic to read from the original stream and write to the Zipoutput stream (constructed around the pipedOutput) in the ZipStreamConverter class that I didn't show. (Exercise left to the reader.) Am I close to what you wanted?
The alternative approach is to create a custom input stream that wraps an InputStream and implements the zip compression algorithm as it reads from the wrapped stream. That logic would either be inlined or delegated to some class that I don't think exists in the JDK. In other words you'd probably have to implement the compression logic. I'm sure there's an object you can talk to directly but I'm not clever enough to find it.
[ June 09, 2006: Message edited by: Clifton Craig ]