Salome HOME
20954bf273b25ae9fa8d77c9457fa9f52bd7f7b3
[tools/siman.git] / Workspace / SPlat / src / org / splat / manox / Toolbox.java
1 package org.splat.manox;
2
3 import java.io.File;
4
5
6 public abstract class Toolbox {
7
8 //  ==============================================================================================================================
9 //  Public services
10 //  ==============================================================================================================================
11
12     public static Reader getReader (File file) {
13 //  ------------------------------------------
14       if (!file.exists()) return null;
15
16           String[] name = file.getName().split("\\x2E");                  // Split around '.' (period) character
17           String   fext = name[name.length-1];
18           Reader   me   = null;
19           
20           if (fext.equals("xml")) {
21         XMLDocument                odoc = new XMLDocument(file);      // Parses the file
22         if (odoc.isWordDocument()) me   = new WordXMLDocument(odoc);
23           } else
24       if (fext.equals("docx")) {
25 //TODO: me = new WordDOCXDocument(file);
26       }
27       return me;
28     }
29
30     public static Writer getWriter (File file) {
31 //  ------------------------------------------
32       if (!file.exists()) return null;
33
34           String[] name = file.getName().split("\\x2E");                  // Split around '.' (period) character
35           String   fext = name[name.length-1];
36           Writer   me   = null;
37           
38           if (fext.equals("xml")) {
39         XMLDocument                odoc = new XMLDocument(file);      // Parses the file
40         if (odoc.isWordDocument()) me   = new WordXMLDocument(odoc);
41           }
42       return me;
43     }
44 }