1 package net.suberic.pooka; 2 import java.io.*; 3 4 8 public class FileSignatureGenerator extends SignatureGeneratorImpl { 9 10 public FileSignatureGenerator() { 11 } 12 13 17 18 public String generateSignature(String text) { 19 if (profile != null) { 20 String fileName = Pooka.getProperty("UserProfile." + profile.getName() + ".signatureFile", ""); 21 if (!fileName.equals("")) { 22 File f = new File(fileName); 23 if (f.exists() && f.canRead()) { 24 try { 25 StringBuffer returnValue = new StringBuffer (); 26 BufferedReader reader = new BufferedReader(new FileReader(f)); 27 boolean done = false; 28 while (!done) { 29 String nextLine = reader.readLine(); 30 if (nextLine != null) { 31 returnValue.append(nextLine); 32 returnValue.append("\n"); 33 } else { 34 done = true; 35 } 36 } 37 38 return returnValue.toString(); 39 } catch (Exception e) { 40 e.printStackTrace(); 41 } 42 } 43 } 44 } 45 46 return null; 47 } 48 49 } 50 | Popular Tags |