1 6 7 package org.contineo.core.text.parser; 8 9 import java.io.BufferedInputStream ; 10 import java.io.File ; 11 import java.io.FileInputStream ; 12 import org.apache.log4j.Level; 13 import org.apache.log4j.Logger; 14 import org.contineo.core.LoggingManager; 15 19 public class WPDParser implements Parser { 20 21 24 private StringBuffer content = new StringBuffer (); 25 26 30 private Logger logger; 31 32 private final int EOF = -1; 33 34 35 public WPDParser(File file) { 36 logger = LoggingManager.getLogger(this.getClass()); 37 init(file); 38 } 39 40 protected void init(File file) { 41 try { 42 FileInputStream in = new FileInputStream (file); 43 BufferedInputStream bis = new BufferedInputStream (in); 44 int token = 0; 45 while ((token = bis.read()) != EOF) { 46 if (token == 128) 48 token = 32; 49 if (token > 31 && token < 126) 50 content.append((char)token); 51 } 52 in.close(); 53 bis.close(); 54 } 55 catch (Exception ex) { 56 if (logger.isEnabledFor(Level.ERROR)) 57 logger.error(ex.getMessage()); 58 } 59 } 60 61 65 public StringBuffer getContent() { 66 return content; 67 } 68 69 70 public String getVersion() { 71 return ""; 72 } 73 74 77 public String getAuthor() { 78 return ""; 79 } 80 81 84 public String getSourceDate() { 85 return ""; 86 } 87 88 91 public String getKeywords() { 92 return ""; 93 } 94 95 98 public String getTitle() { 99 return ""; 100 } 101 102 } 103 | Popular Tags |