Reduce churn when parsing Jar files

Update CentralDirectoryParser to reduce the number of objects created
when parsing the central directory. A single CentralDirectoryFileHeader
object is now reused as entries are parsed.

Fixes gh-5260
This commit is contained in:
Phillip Webb
2016-04-11 15:53:47 -07:00
parent 5bc274ca09
commit caaf8e96b9
4 changed files with 86 additions and 65 deletions

View File

@@ -105,7 +105,7 @@ public class CentralDirectoryParserTests {
@Override
public void visitFileHeader(CentralDirectoryFileHeader fileHeader,
int dataOffset) {
this.headers.add(fileHeader);
this.headers.add(fileHeader.clone());
}
@Override