1
2
3
4
5
6
7 package net.sf.gumshoe.indexer;
8
9 import java.io.File;
10 import java.io.InputStreamReader;
11 import java.util.List;
12 import java.util.Vector;
13 import java.util.zip.ZipFile;
14
15
16 import org.apache.lucene.document.Document;
17 import org.apache.lucene.document.Field;
18
19 /***
20 * @author Gabor
21 *
22 * TODO To change the template for this generated type comment go to
23 * Window - Preferences - Java - Code Style - Code Templates
24 */
25 public class OOOContentReader extends ContentReader {
26 /***
27 *
28 */
29 public OOOContentReader() {
30 super();
31 }
32
33 /*** Document?
34 * @see net.sf.gumshoe.indexer.ContentReader#getCategory()
35 */
36 public String getCategory() {
37
38 return "";
39 }
40
41
42
43
44 public List getSupportedExtensions() {
45 List extensions=new Vector();
46 extensions.add("sxw");
47 extensions.add("sxc");
48 extensions.add("sxd");
49 extensions.add("sxi");
50 return extensions;
51 }
52
53
54
55
56 public Document getDocument(File f) throws Exception {
57 Document doc = new Document();
58 addDefaultFields(f, doc, "");
59 ZipFile zf=new ZipFile(f);
60 InputStreamReader isr=new InputStreamReader(zf.getInputStream(zf.getEntry("content.xml")));
61 doc.add(Field.Text(CONTENTS, getContentFromXML(isr)));
62 return doc;
63 }
64 }