1 18 package net.sf.drftpd.master.config; 19 20 import java.io.BufferedReader ; 21 import java.io.FileReader ; 22 import java.io.IOException ; 23 import java.util.ArrayList ; 24 import java.util.Collection ; 25 import java.util.Iterator ; 26 27 import net.sf.drftpd.master.FtpReply; 28 29 34 public class MessagePathPermission extends StringPathPermission { 35 private ArrayList message; 36 public MessagePathPermission( 37 String path, 38 String messageFile, 39 Collection users) 40 throws IOException { 41 super(path, users); 42 message = new ArrayList (); 43 BufferedReader in = new BufferedReader (new FileReader (messageFile)); 44 String line; 45 try { 46 while ((line = in.readLine()) != null) { 47 message.add(line); 48 } 49 } finally { 50 in.close(); 51 } 52 message.trimToSize(); 53 } 54 55 public void printMessage(FtpReply response) { 56 for (Iterator iter = message.iterator(); iter.hasNext();) { 57 String line = (String ) iter.next(); 58 response.addComment(line); 59 } 60 } 61 } 62 | Popular Tags |