use of org.gridkit.jvmtool.event.EventReader 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) + "'");
}
}
Aggregations