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, |
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 |
} |
} |
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 |
} |
} |