< prev index next >

test/lib/jdk/test/lib/hprof/parser/HprofReader.java

Print this page
rev 58893 : 8237354: Add option to jcmd to write a gzipped heap dump
Reviewed-by:

*** 1,7 **** /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 154,169 **** public static boolean verifyMagicNumber(int numberRead) { return (numberRead == MAGIC_NUMBER); } ! public HprofReader(String fileName, PositionDataInputStream in, int dumpNumber, boolean callStack, int debugLevel) throws IOException { super(in); ! RandomAccessFile file = new RandomAccessFile(fileName, "r"); ! this.snapshot = new Snapshot(MappedReadBuffer.create(file)); this.dumpsToSkip = dumpNumber - 1; this.callStack = callStack; this.debugLevel = debugLevel; names = new Hashtable<Long, String>(); threadObjects = new Hashtable<Integer, ThreadObject>(43); --- 154,168 ---- public static boolean verifyMagicNumber(int numberRead) { return (numberRead == MAGIC_NUMBER); } ! public HprofReader(ReadBuffer readBuffer, PositionDataInputStream in, int dumpNumber, boolean callStack, int debugLevel) throws IOException { super(in); ! this.snapshot = new Snapshot(readBuffer); this.dumpsToSkip = dumpNumber - 1; this.callStack = callStack; this.debugLevel = debugLevel; names = new Hashtable<Long, String>(); threadObjects = new Hashtable<Integer, ThreadObject>(43);
*** 173,182 **** --- 172,188 ---- stackTraces = new Hashtable<Integer, StackTrace>(43); classNameFromSerialNo = new Hashtable<Integer, String>(); } } + public HprofReader(String fileName, PositionDataInputStream in, + int dumpNumber, boolean callStack, int debugLevel) + throws IOException { + this(MappedReadBuffer.create(new RandomAccessFile(fileName, "r")), + in, dumpNumber, callStack, debugLevel); + } + public Snapshot read() throws IOException { currPos = 4; // 4 because of the magic number version = readVersionHeader(); identifierSize = in.readInt(); snapshot.setIdentifierSize(identifierSize);
< prev index next >