Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/shark/HprofWriter

HprofWriter

[jvm]\ class HprofWriter : Closeable

Generates Hprof files.

Call openWriterFor to obtain a new instance.

Call write to add records and close when you’re done.

Types

Name Summary
Companion [jvm]
object Companion

Functions

Name Summary
close [jvm]
open override fun close()
Flushes to disk all HprofRecord.HeapDumpRecord that are currently written to the in memory buffer, then closes the file.
valuesToBytes [jvm]
fun valuesToBytes(values: List<ValueHolder>): ByteArray
Helper method for creating a ByteArray for InstanceDumpRecord.fieldValues from a list of ValueHolder.
write [jvm]
fun write(record: HprofRecord)
Appends a HprofRecord to the heap dump. If record is a HprofRecord.HeapDumpRecord then it will not be written to an in memory buffer and written to file only when the next a record that is not a HprofRecord.HeapDumpRecord is written or when close is called.

Properties

Name Summary
hprofHeader [jvm]
val hprofHeader: HprofHeader