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
{
30 public TmfEvent
parseNextEvent(ITmfTrace
<?
> stream
, TmfContext context
)
32 // TODO Auto-generated method stub
36 // // ========================================================================
38 // // ========================================================================
40 // private final int NB_FORMATS = 10;
41 // private final TmfEventFormat[] fFormats;
43 // // ========================================================================
45 // // ========================================================================
47 // public LTTngEventParserStub() {
48 // fFormats = new TmfEventFormat[NB_FORMATS];
49 // for (int i = 0; i < NB_FORMATS; i++) {
50 // Vector<String> format = new Vector<String>();
51 // for (int j = 1; j <= i; j++) {
52 // format.add(new String("Fmt-" + i + "-Fld-" + j));
54 // String[] fields = new String[i];
55 // fFormats[i] = new TmfEventFormat(format.toArray(fields));
59 // // ========================================================================
61 // // ========================================================================
63 // // ========================================================================
65 // // ========================================================================
68 // * @see org.eclipse.linuxtools.tmf.eventlog.ITmfEventParser#parseNextEvent()
70 // static final String typePrefix = "Type-";
71 // public TmfEvent parseNextEvent(ITmfTrace eventStream, TmfTraceContext context) throws IOException {
73 // if (! (eventStream instanceof LTTngTraceStub)) {
77 // // Highly inefficient...
78 // RandomAccessFile stream = ((LTTngTraceStub) eventStream).getStream();
79 // String name = eventStream.getName();
80 // name = name.substring(name.lastIndexOf('/') + 1);
82 // synchronized(stream) {
84 // if (context != null)
85 // location = (Long) (context.getLocation());
86 // stream.seek(location);
89 // // Read the individual fields
90 // long ts = stream.readLong();
91 // String source = stream.readUTF();
92 // String type = stream.readUTF();
93 // @SuppressWarnings("unused")
94 // int reference = stream.readInt();
96 // // Read the event parts
97 // int typeIndex = Integer.parseInt(type.substring(typePrefix.length()));
98 // String[] fields = new String[typeIndex];
99 // for (int i = 0; i < typeIndex; i++) {
100 // fields[i] = stream.readUTF();
103 // // Format the content from the individual fields
104 // String content = "[";
105 // if (typeIndex > 0) {
106 // content += fields[0];
108 // for (int i = 1; i < typeIndex; i++) {
109 // content += ", " + fields[i];
113 // // Update the context
114 // context.setLocation(stream.getFilePointer());
115 // context.incrIndex();
117 // long ts2 = stream.readLong();
118 // context.setTimestamp(new LTTngTimestampStub(ts2));
119 // } catch (EOFException e) {
120 // context.setTimestamp(null);
123 // // Create the event
124 // TmfEvent event = new TmfEvent(
125 // new LTTngTimestampStub(ts),
126 // new TmfEventSource(source),
127 // new TmfEventType(type, fFormats[typeIndex]),
128 // new TmfEventContent(content, fFormats[typeIndex]),
129 // new TmfEventReference(name));
133 // } catch (EOFException e) {
134 // context.setTimestamp(null);
This page took 0.038664 seconds and 6 git commands to generate.