1 17 18 package org.objectweb.jac.aspects.export; 19 20 import java.io.File ; 21 import java.io.FileOutputStream ; 22 import java.io.FileWriter ; 23 import java.io.IOException ; 24 import java.io.OutputStream ; 25 import java.io.Writer ; 26 import java.util.HashSet ; 27 import org.objectweb.jac.core.AspectComponent; 28 import org.objectweb.jac.core.NameRepository; 29 30 public class ExportAC extends AspectComponent implements ExportConf { 31 HashSet roots = new HashSet (); 32 33 NameRepository nr; 34 public ExportAC() { 35 nr = (NameRepository)NameRepository.get(); 36 } 37 38 42 public void addRoot(String nameExpr) { 43 roots.add(nameExpr); 44 } 45 46 HashSet allow = new HashSet (); 47 public void allowExport(String classExpr) { 48 allow.add(classExpr); 49 } 50 51 HashSet deny = new HashSet (); 52 public void denyExport(String classExpr) { 53 deny.add(classExpr); 54 } 55 56 public static final String DEFAULT_ENCODING = "UTF-8"; 57 58 68 public void export(OutputStream out, String encoding) throws IOException { 69 Exporter exporter = new Exporter(roots,allow,deny); 70 exporter.export(out, encoding); 71 } 72 73 83 public void export(OutputStream out) throws IOException { 84 export(out,DEFAULT_ENCODING); 85 } 86 87 97 public void export(File file) throws IOException { 98 export(file,DEFAULT_ENCODING); 99 } 100 101 102 113 public void export(File file, String encoding) throws IOException { 114 FileOutputStream writer = new FileOutputStream (file); 115 try { 116 export(writer,encoding); 117 } finally { 118 writer.close(); 119 } 120 } 121 } 122 | Popular Tags |