Results 1 to 8 of 8
Thread: Data uncompression question
- 03-18-2012, 05:05 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 6
- Rep Power
- 0
Data uncompression question
I receive compressed data in chunks. Instead of saving the whole data and then uncompressing it I want to directly perform the uncompression for each chunk.
Can a ZipInputStream be used to uncompress chunks of data? If the answer is yes, how can this be done given the fact that I have only one ZipEntry received in multiple chunks. If the answer is no, please tell me how to solve this problem.
Thank you
- 03-18-2012, 05:32 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,413
- Blog Entries
- 7
- Rep Power
- 17
Re: Data uncompression question
A ZipInputStream wraps an ordinary InputStream; it isn't much trouble to create an InputStream that reads those chunks and passes them as if they were a continuous stream of bytes.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-18-2012, 05:52 PM #3
Re: Data uncompression question
Can a compressed file be divided anywhere in its stream of bytes or are there boundaries that must be maintained?
You may not be able to divide a compressed file without understanding its internals.If you don't understand my response, don't ignore it, ask a question.
- 03-21-2012, 05:08 PM #4
Member
- Join Date
- Mar 2011
- Posts
- 6
- Rep Power
- 0
Re: Data uncompression question
Ok, Thank you, I succeeded uncompressing the data in chunks.
However I have another issue: the uncompression is really slow. The inputStream points to a database Blob. I tried to uncompress 500Kb/chunk in order to save memory.
while ((count = zin.read(data, 0, chunckSize)) != -1)
{
LOGGER.debug("Reading chunck count="+count+", time="+(System.currentTimeMillis()-time));
time = System.currentTimeMillis();
fout.write(data, 0, count);
LOGGER.debug("Writting chunck count="+count+", time="+(System.currentTimeMillis()-time));
time = System.currentTimeMillis();
}
The above logs are displaying count~512 bytes.
I read that ZIpInputStream uses a PushbackBuffer of 512 bytes. How can I improve the performance(time) of the uncompression.
- 03-21-2012, 06:15 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,413
- Blog Entries
- 7
- Rep Power
- 17
Re: Data uncompression question
Wrap your chunk reading InputStream around a BufferedInputStream?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-22-2012, 12:12 PM #6
Member
- Join Date
- Mar 2011
- Posts
- 6
- Rep Power
- 0
Re: Data uncompression question
It's already wrapped with a BufferedInputStream.
It's pretty strange. I also tried this with a FileInputStream because I thought it might be the database reading from a BLOB. It worked much faster but the ammount of read data was still around 512.
- 03-22-2012, 12:33 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,413
- Blog Entries
- 7
- Rep Power
- 17
Re: Data uncompression question
What is the value of 'chunkSize' in your code?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-22-2012, 01:22 PM #8
Member
- Join Date
- Mar 2011
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Submit question scheme data into final score.(New to coding in general)
By august94 in forum New To JavaReplies: 2Last Post: 02-19-2012, 07:31 AM -
Getting problem inserting data in data base
By anupama in forum New To JavaReplies: 4Last Post: 12-15-2010, 10:03 PM -
Data Pipeline 2 - Data Transformation Toolkit for Java Released
By dele in forum Java SoftwareReplies: 0Last Post: 10-31-2008, 02:13 PM -
Data Sorting in a .data file using java
By stutiger99 in forum New To JavaReplies: 2Last Post: 10-08-2008, 02:52 AM -
simple question about private data
By littleBean in forum New To JavaReplies: 12Last Post: 07-02-2008, 04:09 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks