/[classpath]/gjdoc/src/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet.java
ViewVC logotype

Diff of /gjdoc/src/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by julian, Mon Nov 22 22:29:58 2004 UTC revision 1.8 by julian, Tue Nov 23 12:49:55 2004 UTC
# Line 151  public class DocTranslet implements Erro Line 151  public class DocTranslet implements Erro
151           parameters.put("gjdoc.option.nocomment", xsltBoolean(options.nocomment));           parameters.put("gjdoc.option.nocomment", xsltBoolean(options.nocomment));
152           parameters.put("gjdoc.option.nohelp", xsltBoolean(options.nohelp));           parameters.put("gjdoc.option.nohelp", xsltBoolean(options.nohelp));
153           parameters.put("gjdoc.option.splitindex", xsltBoolean(options.splitindex));           parameters.put("gjdoc.option.splitindex", xsltBoolean(options.splitindex));
154             parameters.put("gjdoc.option.linksource", xsltBoolean(options.linksource));
155             parameters.put("gjdoc.option.windowtitle", options.windowtitle);
156             parameters.put("gjdoc.option.helpfile", options.helpfile);
157             parameters.put("gjdoc.option.stylesheet", options.stylesheet);
158    
159           List outputFileList = getOutputFileList(mainResourceURL,           List outputFileList = getOutputFileList(mainResourceURL,
160                                                   xmlSourceDirectory,                                                   xmlSourceDirectory,
# Line 182  public class DocTranslet implements Erro Line 186  public class DocTranslet implements Erro
186                 throw new DocTransletException("Target directory " + packageTargetDir + " does not exist and cannot be created.");                 throw new DocTransletException("Target directory " + packageTargetDir + " does not exist and cannot be created.");
187              }              }
188    
189                if (options.linksource) {
190                   File sourceTargetDirectory = new File(targetDirectory, "src-html");
191                   File sourceTargetFile = new File(sourceTargetDirectory, fileInfo.getName());
192                   File sourcePackageTargetDir = getParentFile(sourceTargetFile);
193    
194                   if (!sourcePackageTargetDir.exists() && !sourcePackageTargetDir.mkdirs()) {
195                      throw new DocTransletException("Target directory " + packageTargetDir + " does not exist and cannot be created.");
196                   }
197                }
198    
199              if (null != fileInfo.getSource()) {              if (null != fileInfo.getSource()) {
200                            
201                 reporter.printNotice("Copying " + fileInfo.getComment() + "...");                 reporter.printNotice("Copying " + fileInfo.getComment() + "...");
202                 InputStream in = new URL(mainResourceURL, fileInfo.getSource()).openStream();                 InputStream in = new URL(mainResourceURL, fileInfo.getSource()).openStream();
203                 FileOutputStream out = new FileOutputStream(targetFile.getAbsolutePath());                 FileOutputStream out = new FileOutputStream(targetFile.getAbsolutePath());
204                 copyStream(in, out);                 Driver.copyStream(in, out);
205                 in.close();                 in.close();
206                 out.close();                 out.close();
207              }              }
# Line 379  public class DocTranslet implements Erro Line 393  public class DocTranslet implements Erro
393        }        }
394     }     }
395    
    private static void copyStream(InputStream in, OutputStream out)  
       throws IOException {  
   
       byte[] buf = new byte[256];  
       int nread;  
   
       while ((nread = in.read(buf)) >= 0) {  
          out.write(buf, 0, nread);  
       }  
    }  
   
396     private static String xsltBoolean(boolean b) {     private static String xsltBoolean(boolean b) {
397        return b ? "1" : "";        return b ? "1" : "";
398     }     }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26