- Introduced TmfExperiment (single trace for now)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / stubs / org / eclipse / linuxtools / lttng / stubs / LTTngEventStreamStub.java
1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Francois Chouinard (fchouinard@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng.stubs;
14
15 import java.io.FileNotFoundException;
16 import java.io.IOException;
17 import java.io.RandomAccessFile;
18 import java.util.Map;
19
20 import org.eclipse.linuxtools.tmf.trace.ITmfEventParser;
21 import org.eclipse.linuxtools.tmf.trace.TmfTrace;
22
23 /**
24 * <b><u>TmfEventStreamStub</u></b>
25 * <p>
26 * TODO: Implement me. Please.
27 */
28 public class LTTngEventStreamStub extends TmfTrace {
29
30 // ========================================================================
31 // Attributes
32 // ========================================================================
33
34 // The actual stream
35 private final RandomAccessFile fStream;
36
37 // ========================================================================
38 // Constructors
39 // ========================================================================
40
41 /**
42 * @param filename
43 * @param parser
44 * @throws FileNotFoundException
45 */
46 public LTTngEventStreamStub(String filename, ITmfEventParser parser) throws FileNotFoundException {
47 this(filename, parser, DEFAULT_CACHE_SIZE);
48 }
49
50 /**
51 * @param filename
52 * @param parser
53 * @param cacheSize
54 * @throws FileNotFoundException
55 */
56 public LTTngEventStreamStub(String filename, ITmfEventParser parser, int cacheSize) throws FileNotFoundException {
57 super(filename, parser, cacheSize);
58 fStream = new RandomAccessFile(filename, "r");
59 }
60
61 // ========================================================================
62 // Accessors
63 // ========================================================================
64
65 public RandomAccessFile getStream() {
66 return fStream;
67 }
68
69 // ========================================================================
70 // Operators
71 // ========================================================================
72
73 /* (non-Javadoc)
74 * @see org.eclipse.linuxtools.tmf.eventlog.ITmfStreamLocator#seekLocation(java.lang.Object)
75 */
76 public StreamContext seekLocation(Object location) {
77 StreamContext context = null;
78 try {
79 fStream.seek((location != null) ? (Long) location : 0);
80 context = new StreamContext(getCurrentLocation(), 0);
81 } catch (IOException e) {
82 // TODO Auto-generated catch block
83 e.printStackTrace();
84 }
85 return context;
86 }
87
88 /* (non-Javadoc)
89 * @see org.eclipse.linuxtools.tmf.eventlog.ITmfStreamLocator#getCurrentLocation()
90 */
91 public Object getCurrentLocation() {
92 try {
93 return new Long(fStream.getFilePointer());
94 } catch (IOException e) {
95 // TODO Auto-generated catch block
96 e.printStackTrace();
97 }
98 return null;
99 }
100
101 // ========================================================================
102 // Helper functions
103 // ========================================================================
104
105 /* (non-Javadoc)
106 * @see org.eclipse.linuxtools.tmf.eventlog.ITmfEventStream#getAttributes()
107 */
108 public Map<String, Object> getAttributes() {
109 // TODO Auto-generated method stub
110 return null;
111 }
112
113 }
This page took 0.053292 seconds and 5 git commands to generate.