1 18 package org.apache.tools.ant.taskdefs.email; 19 20 import java.io.BufferedInputStream ; 21 import java.io.File ; 22 import java.io.FileInputStream ; 23 import java.io.IOException ; 24 import java.io.PrintStream ; 25 import org.apache.tools.ant.BuildException; 26 import org.apache.tools.ant.util.UUEncoder; 27 28 33 class UUMailer extends PlainMailer { 34 protected void attach(File file, PrintStream out) 35 throws IOException { 36 if (!file.exists() || !file.canRead()) { 37 throw new BuildException("File \"" + file.getName() 38 + "\" does not exist or is not " 39 + "readable."); 40 } 41 42 FileInputStream finstr = new FileInputStream (file); 43 44 try { 45 BufferedInputStream in = new BufferedInputStream (finstr); 46 UUEncoder encoder = new UUEncoder(file.getName()); 47 48 encoder.encode(in, out); 49 50 } finally { 51 finstr.close(); 52 } 53 } 54 } 55 56 | Popular Tags |