public final class ChunkReader
extends java.lang.Object
Each chunk will be self-contained and parsable, for example by wrapping it in a
ByteArrayInputStream
and using the JfrLoaderToolkit
.
Modifier and Type | Class and Description |
---|---|
private static class |
ChunkReader.ChunkIterator
Chunk iterator for an uncompressed JFR file.
|
private static class |
ChunkReader.StreamChunkIterator
Iterator reading JFR chunks from a stream.
|
private static class |
ChunkReader.StreamState |
Modifier and Type | Field and Description |
---|---|
private static int[] |
GZ_MAGIC |
private static int |
HEADER_SIZE |
private static int[] |
JFR_MAGIC |
private static byte[] |
JFR_MAGIC_BYTES |
private static int[] |
ZIP_MAGIC |
Modifier | Constructor and Description |
---|---|
private |
ChunkReader() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Program for listing the number of chunks in a recording.
|
static java.util.Iterator<byte[]> |
readChunks(java.io.File jfrFile)
Reads a JFR file, chunk by chunk.
|
static java.util.Iterator<byte[]> |
readChunks(java.io.InputStream jfrStream)
Reads a JFR file, chunk by chunk, from a stream.
|
private static final byte[] JFR_MAGIC_BYTES
private static final int[] JFR_MAGIC
private static final int[] ZIP_MAGIC
private static final int[] GZ_MAGIC
private static final int HEADER_SIZE
public static java.util.Iterator<byte[]> readChunks(java.io.File jfrFile) throws java.io.IOException
Each chunk will be self contained and parsable, for example by wrapping it in a
ByteArrayInputStream
. Note that Iterator.next()
can throw
IllegalArgumentException
if it encounters a corrupted chunk.
jfrFile
- the file to read binary data fromjava.io.IOException
public static java.util.Iterator<byte[]> readChunks(java.io.InputStream jfrStream) throws java.io.IOException
Each chunk will be self contained and parsable, for example by wrapping it in a
ByteArrayInputStream
. Note that Iterator.next()
can throw
IllegalArgumentException
if it encounters a corrupted chunk.
jfrStream
- the stream to read binary data fromjava.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
args
- takes one argument, which must be the path to a recordingjava.io.IOException
- if there was a problem reading the file