On Tue, 26 Jan 2021 04:41:40 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> So the problem is that the code in GzipRandomAccess.getAccess() returns NULL >> if it doesn't find the "HPROF BLOCKSIZE" comment, but you are also saying >> that tools like heaphero.io work fine without the comment. So maybe you just >> need to fix GzipRandomAccess.getAccess() to use a default blocksize if none >> is specified. >> >> On the other hand, it seems it would be best if the SA hprof file was no >> different than the jcmd hprof file, and the SA file also included the >> comment. But as you said GZIPOutputStream() does not support adding a >> comment in the same manner as the zlib library does. I'm not sure how you >> would go about adding the support, so probably it is not worth it. > > As for any testing requirement, maybe you could pass in a flag to Reader > indicating whether or not the testing requires the "HPROF BLOCKSIZE" comment. 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 ------------- PR: https://git.openjdk.java.net/jdk/pull/1712