001 package jp.osdl.jbento2.analyzer; 002 003 import java.io.IOException; 004 import java.io.Reader; 005 import java.util.Iterator; 006 import java.util.List; 007 008 import org.apache.commons.io.IOUtils; 009 010 public class JBentoSampleParser implements SampleParser { 011 012 public SampleList parse(Reader reader) throws IOException { 013 List lines = IOUtils.readLines(reader); 014 SampleList result = new SampleList(); 015 for (Iterator it = lines.iterator(); it.hasNext(); ) { 016 String line = (String)it.next(); 017 Sample s = new Sample(); 018 try { 019 String[] items = line.split(","); 020 s.setClientId(items[1]); 021 s.setRequestType(items[2]); 022 for (int i = 3; i < items.length; i++) { 023 s.addTime(new Time(items[i])); 024 } 025 } catch (Exception ex) { 026 // incomplete line - JMeter was killed. 027 continue; 028 } 029 result.add(s); 030 } 031 return result; 032 } 033 }