sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/analyser/StreamFileParser.java
equal
deleted
inserted
replaced
44 if (!streamFile.exists()) throw new IOException(Messages.getString("StreamFileParser.fileNotFound")); //$NON-NLS-1$ |
44 if (!streamFile.exists()) throw new IOException(Messages.getString("StreamFileParser.fileNotFound")); //$NON-NLS-1$ |
45 |
45 |
46 streamData = new byte[(int)streamFile.length()]; |
46 streamData = new byte[(int)streamFile.length()]; |
47 FileInputStream fis = new FileInputStream(streamFile); |
47 FileInputStream fis = new FileInputStream(streamFile); |
48 fis.read(streamData); |
48 fis.read(streamData); |
|
49 fis.close(); |
49 |
50 |
50 readLoop(); |
51 readLoop(); |
51 } |
52 } |
52 |
53 |
53 public byte[] getDataForTraceType(int traceType) |
54 public byte[] getDataForTraceType(int traceType) |
158 { |
159 { |
159 baos = new ByteArrayOutputStream(); |
160 baos = new ByteArrayOutputStream(); |
160 dataBlocks.put(typeInt, baos); |
161 dataBlocks.put(typeInt, baos); |
161 } |
162 } |
162 |
163 |
163 baos.write(streamData,readOffset,currentLength); |
164 |
|
165 try { |
|
166 baos.write(streamData,readOffset,currentLength); |
|
167 baos.flush(); |
|
168 } catch (IOException e) { |
|
169 e.printStackTrace(); |
|
170 }finally{ |
|
171 if(baos != null){ |
|
172 try { |
|
173 baos.close(); |
|
174 } catch (IOException e) { |
|
175 e.printStackTrace(); |
|
176 } |
|
177 } |
|
178 } |
164 readOffset += currentLength; |
179 readOffset += currentLength; |
165 } |
180 } |
166 |
181 |
167 /* Support for reading available traces */ |
182 /* Support for reading available traces */ |
168 public Set<Integer> allTraceType() { |
183 public Set<Integer> allTraceType() { |