Revision 104,
786 bytes
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[104] | 1 | package test.local.db.loader; |
---|
| 2 | |
---|
| 3 | import java.io.BufferedReader; |
---|
| 4 | import java.io.IOException; |
---|
| 5 | import java.io.Reader; |
---|
| 6 | |
---|
| 7 | /** |
---|
| 8 | * |
---|
| 9 | * @author Marcin Krystek |
---|
| 10 | * |
---|
| 11 | */ |
---|
| 12 | public class StatsParser extends BufferedReader { |
---|
| 13 | |
---|
| 14 | protected String separator = ";"; |
---|
| 15 | |
---|
| 16 | public StatsParser(Reader in) { |
---|
| 17 | super(in); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | public void setSeparator(String arg){ |
---|
| 21 | this.separator = arg; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | public String readLine() throws IOException{ |
---|
| 25 | String line = super.readLine(); |
---|
| 26 | if(line == null) |
---|
| 27 | return null; |
---|
| 28 | |
---|
| 29 | // this will skip empty lines |
---|
| 30 | while(line != null && line.length() == 0) |
---|
| 31 | line = super.readLine(); |
---|
| 32 | |
---|
| 33 | return line; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | public String[] readValues() throws IOException{ |
---|
| 37 | String line = readLine(); |
---|
| 38 | if(line == null) |
---|
| 39 | return null; |
---|
| 40 | |
---|
| 41 | String tab[] = line.split(separator); |
---|
| 42 | |
---|
| 43 | return tab; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.