1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng
.stubs
;
15 import java
.io
.IOException
;
17 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
18 import org
.eclipse
.linuxtools
.tmf
.parser
.ITmfEventParser
;
19 import org
.eclipse
.linuxtools
.tmf
.trace
.ITmfTrace
;
20 import org
.eclipse
.linuxtools
.tmf
.trace
.TmfContext
;
23 * <b><u>TmfEventParserStub</u></b>
25 * TODO: Implement me. Please.
27 public class LTTngEventParserStub
implements ITmfEventParser
{
29 public TmfEvent
parseNextEvent(ITmfTrace stream
, TmfContext context
)
31 // TODO Auto-generated method stub
35 // // ========================================================================
37 // // ========================================================================
39 // private final int NB_FORMATS = 10;
40 // private final TmfEventFormat[] fFormats;
42 // // ========================================================================
44 // // ========================================================================
46 // public LTTngEventParserStub() {
47 // fFormats = new TmfEventFormat[NB_FORMATS];
48 // for (int i = 0; i < NB_FORMATS; i++) {
49 // Vector<String> format = new Vector<String>();
50 // for (int j = 1; j <= i; j++) {
51 // format.add(new String("Fmt-" + i + "-Fld-" + j));
53 // String[] fields = new String[i];
54 // fFormats[i] = new TmfEventFormat(format.toArray(fields));
58 // // ========================================================================
60 // // ========================================================================
62 // // ========================================================================
64 // // ========================================================================
67 // * @see org.eclipse.linuxtools.tmf.eventlog.ITmfEventParser#parseNextEvent()
69 // static final String typePrefix = "Type-";
70 // public TmfEvent parseNextEvent(ITmfTrace eventStream, TmfTraceContext context) throws IOException {
72 // if (! (eventStream instanceof LTTngTraceStub)) {
76 // // Highly inefficient...
77 // RandomAccessFile stream = ((LTTngTraceStub) eventStream).getStream();
78 // String name = eventStream.getName();
79 // name = name.substring(name.lastIndexOf('/') + 1);
81 // synchronized(stream) {
83 // if (context != null)
84 // location = (Long) (context.getLocation());
85 // stream.seek(location);
88 // // Read the individual fields
89 // long ts = stream.readLong();
90 // String source = stream.readUTF();
91 // String type = stream.readUTF();
92 // @SuppressWarnings("unused")
93 // int reference = stream.readInt();
95 // // Read the event parts
96 // int typeIndex = Integer.parseInt(type.substring(typePrefix.length()));
97 // String[] fields = new String[typeIndex];
98 // for (int i = 0; i < typeIndex; i++) {
99 // fields[i] = stream.readUTF();
102 // // Format the content from the individual fields
103 // String content = "[";
104 // if (typeIndex > 0) {
105 // content += fields[0];
107 // for (int i = 1; i < typeIndex; i++) {
108 // content += ", " + fields[i];
112 // // Update the context
113 // context.setLocation(stream.getFilePointer());
114 // context.incrIndex();
116 // long ts2 = stream.readLong();
117 // context.setTimestamp(new LTTngTimestampStub(ts2));
118 // } catch (EOFException e) {
119 // context.setTimestamp(null);
122 // // Create the event
123 // TmfEvent event = new TmfEvent(
124 // new LTTngTimestampStub(ts),
125 // new TmfEventSource(source),
126 // new TmfEventType(type, fFormats[typeIndex]),
127 // new TmfEventContent(content, fFormats[typeIndex]),
128 // new TmfEventReference(name));
132 // } catch (EOFException e) {
133 // context.setTimestamp(null);
This page took 0.034049 seconds and 6 git commands to generate.