commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Herber <>
Subject [compress] add a memory efficient stream compress InputStream - e.g. a "DeflaterInputStream"
Date Tue, 01 Sep 2009 10:33:23 GMT

I've the same issue as described in

My web application recieves an InputStream (an uploaded large file) 
which I need to save compressed in the DB.
Currently (since the file could be really big) I save it GZIP-ed into a 
Temp File and then I open a new InputStream to that file. However this 
process take up more than 60% of the overall method execution:

tempFile = File.createTempFile(Long.toString(getId()), null);
GZIPOutputStream gos = new GZIPOutputStream(new FileOutputStream(tempFile));
IOUtils.copy(is, gos);
is = new FileInputStream(tempFile);
stmt.setBinaryStream(3, is, -1);

The issue is marked as fixed but I didn't find how/where.
Could you kindly give me a sample how to do it?

Thanks a lot for your help

Best regards


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message