001 package jp.osdl.jbento2.report; 002 003 import java.io.File; 004 import java.io.FileOutputStream; 005 import java.io.InputStream; 006 import java.io.OutputStream; 007 008 import org.apache.commons.io.IOUtils; 009 010 public class StaticFileBuilder { 011 012 private File destdirFile; 013 014 public StaticFileBuilder(File destdirFile) { 015 this.destdirFile = destdirFile; 016 } 017 018 public void execute() throws Exception { 019 outputCss(); 020 outputImages(); 021 } 022 023 private void outputCss() throws Exception { 024 // write css 025 InputStream in = null; 026 OutputStream out = null; 027 try { 028 in = getClass().getResourceAsStream("jbento.css"); 029 out = new FileOutputStream(new File(destdirFile, "jbento.css")); 030 IOUtils.copy(in, out); 031 } catch (Exception ex) { 032 throw ex; 033 } finally { 034 IOUtils.closeQuietly(in); 035 IOUtils.closeQuietly(out); 036 } 037 } 038 039 private void outputImages() throws Exception { 040 // write logo 041 InputStream in = null; 042 OutputStream out = null; 043 try { 044 in = getClass().getResourceAsStream("jbento_logo.jpg"); 045 out = new FileOutputStream(new File(destdirFile, "jbento_logo.jpg")); 046 IOUtils.copy(in, out); 047 } catch (Exception ex) { 048 throw ex; 049 } finally { 050 IOUtils.closeQuietly(in); 051 IOUtils.closeQuietly(out); 052 } 053 } 054 055 }