| 1 |
|
package org.apache.lucene.demo.html; |
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
import java.io.*; |
| 20 |
|
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 6 |
Complexity Density: 0.3 |
|
| 21 |
|
class Test { |
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 22 |
0
|
public static void main(String[] argv) throws IOException, InterruptedException {... |
| 23 |
0
|
if ("-dir".equals(argv[0])) { |
| 24 |
0
|
String[] files = new File(argv[1]).list(); |
| 25 |
0
|
java.util.Arrays.sort(files); |
| 26 |
0
|
for (int i = 0; i < files.length; i++) { |
| 27 |
0
|
System.err.println(files[i]); |
| 28 |
0
|
File file = new File(argv[1], files[i]); |
| 29 |
0
|
parse(file); |
| 30 |
|
} |
| 31 |
|
} else |
| 32 |
0
|
parse(new File(argv[0])); |
| 33 |
|
} |
| 34 |
|
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
| 35 |
0
|
public static void parse(File file) throws IOException, InterruptedException {... |
| 36 |
0
|
FileInputStream fis = null; |
| 37 |
0
|
try { |
| 38 |
0
|
fis = new FileInputStream(file); |
| 39 |
0
|
HTMLParser parser = new HTMLParser(fis); |
| 40 |
0
|
System.out.println("Title: " + Entities.encode(parser.getTitle())); |
| 41 |
0
|
System.out.println("Summary: " + Entities.encode(parser.getSummary())); |
| 42 |
0
|
System.out.println("Content:"); |
| 43 |
0
|
LineNumberReader reader = new LineNumberReader(parser.getReader()); |
| 44 |
0
|
for (String l = reader.readLine(); l != null; l = reader.readLine()) |
| 45 |
0
|
System.out.println(l); |
| 46 |
|
} finally { |
| 47 |
0
|
if (fis != null) fis.close(); |
| 48 |
|
} |
| 49 |
|
} |
| 50 |
|
} |