aspose file tools
The moose likes Java in General and the fly likes Doing something dumb trying to stream nested streams Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Doing something dumb trying to stream nested streams" Watch "Doing something dumb trying to stream nested streams" New topic
Author

Doing something dumb trying to stream nested streams

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4442
    
    2

I think I"m close, but I am not getting the expected output



Specifically, if I try to use normal shell utilities to de-base64 and gunzip, I don't get the input string back.
I must be doing something trivially wrong.

Thanks
Pat
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2818
    
    2
I think GZIP may not actually do anything until you close() it. Calling flush() may not be enough.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4442
    
    2

close() seems to make it work. Thanks

I didn't want to call close() because I was worried that it would make the buffer be no longer available.
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2818
    
    2
I think the gzip algorithm wants to know that it has all the data before it compresses it. Or at least, before it considers the compression complete enough to send. A ZipOutputStream might work differently for you.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Pat Farrell wrote:I didn't want to call close() because I was worried that it would make the buffer be no longer available.

Normally that's a good thought, but ByteArrayOutputStream doesn't clear its buffer at all.

But GZIPOutputStream also had method finish() that does the same without closing the underlying stream.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doing something dumb trying to stream nested streams
 
Similar Threads
OutOfMemoryError
errors in compression & release
Compressing and Decompressing strings in Java
XSL transformation using Apache Xalan
BitSet Serialization - Any idea to save disk space and better performance