On Tue, 26 Jan 2021 19:44:55 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

>> Dear @plummercj,
>> I have made  investigation on extending GZIPOutputStream,  since it is not 
>> possible to override/overwrite private method writeHeader(), the only way I 
>> could figure out is to create a class named HProfGZIPOutputStream that 
>> extends DeflaterOutputStream,  copies most of GZIPOutputStream's code and 
>> rewrite a writeHeader() file. 
>> 
>> I am not sure whether it is nice since most of the code are same with 
>> GZIPOutputStream.  IMO, it may be nice if we can add another writeHeader() 
>> method to GZIPOutputStream that support adding file comments, but I am also 
>> not sure whether it is acceptable to add a new method in this general used 
>> class. 
>> 
>> BRs,
>> Lin
>
> I don't think we want to essentially clone GZIPOutputStream into a new 
> HProfGZIPOutputStream in order to solve this problem. I think adding a 
> GZIPOutputStream.writeHeader() method that supports adding a comment make 
> sense, but probably not something that should be done with this CR. A new CR 
> can be filed for it, and maybe take care of it sometime in the future, but 
> for this CR we should focus on a solution that doesn't require the comment be 
> added, and isn't too complicated. 
> 
> Looking back at my original suggestion to put the gzip reading support in 
> Reader.getStack(), I'm not clear on the issue you ran into. You said that 
> GzipRandomAccess requires the "HPROF BLOCKSIZE=" comment, but I'm not so sure 
> you need to use GzipRandomAccess. You can use the same gzip detection 
> mechanism as Reader.readFile() does to see if it can read the file without 
> unzipping it, and if not just do what your test currently does now, and try 
> to read it with GZIPInputStream. You don't need to use GzipRandomAccess here.

Dear Chris,
Thanks for your suggestion, I digressed from the test case and focus too much 
on the GzipRandomAccess. Thanks for pull me back.
And it is hard for me to read file without unzipping it, so I made a change to 
add unzipping in Reader.getStack(). 
Would you like to help reveiw again?

BRs,
Lin

-------------

PR: https://git.openjdk.java.net/jdk/pull/1712

Reply via email to