Search in sources :

Example 1 with ThreadSnapshotExpander

use of org.gridkit.jvmtool.codec.stacktrace.ThreadSnapshotExpander in project jvm-tools by aragozin.

the class ThreadEventCodec method createEventReader.

public static EventReader<Event> createEventReader(byte[] magic, InputStream is) throws IOException {
    if (Arrays.equals(magic, StackTraceCodec.MAGIC)) {
        StackTraceReader lreader = new StackTraceReaderV1(is);
        EventReader<Event> reader = new LegacyThreadEventReader(lreader);
        return reader;
    }
    if (Arrays.equals(magic, StackTraceCodec.MAGIC2)) {
        StackTraceReader lreader = new StackTraceReaderV2(is);
        EventReader<Event> reader = new LegacyThreadEventReader(lreader);
        return reader;
    } else // MAGIC3 is not used
    if (Arrays.equals(magic, StackTraceCodec.MAGIC4)) {
        EventReader<Event> reader = new StackTraceEventReaderV4(is).morph(new ThreadSnapshotExpander());
        return reader;
    } else {
        throw new IOException("Unknown magic '" + new String(magic) + "'");
    }
}
Also used : ThreadSnapshotExpander(org.gridkit.jvmtool.codec.stacktrace.ThreadSnapshotExpander) EventReader(org.gridkit.jvmtool.event.EventReader) Event(org.gridkit.jvmtool.event.Event) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ThreadSnapshotExpander (org.gridkit.jvmtool.codec.stacktrace.ThreadSnapshotExpander)1 Event (org.gridkit.jvmtool.event.Event)1 EventReader (org.gridkit.jvmtool.event.EventReader)1