org.xrn.ant
Class JarHelper

java.lang.Object
  |
  +--org.xrn.ant.JarHelper

public abstract class JarHelper
extends java.lang.Object

A helper static class, that enables, for instance to copy resources from the classpath.

Version:
1.0 : 2002.11.27
Author:
Edouard Mercier

Constructor Summary
JarHelper()
           
 
Method Summary
static boolean copyFileFromJar(java.lang.String fileNameInsideJar, java.lang.String alternativeDirectoryPath, java.io.File copyFile)
          Copies the content of the file that should be present in the jar, into the provided local file.
static boolean copyInputStreamIntoFile(java.io.InputStream inputStream, java.io.File copyFile)
          Copies the content of the input stream into the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarHelper

public JarHelper()
Method Detail

copyFileFromJar

public static boolean copyFileFromJar(java.lang.String fileNameInsideJar,
                                      java.lang.String alternativeDirectoryPath,
                                      java.io.File copyFile)
Copies the content of the file that should be present in the jar, into the provided local file. If the file could not be found, it is searched for in the provided alternative directory.
Note that the original file is not supposed to be a text file.
If the directory path to the new file does not exist, it is created.
Parameters:
fileNameInsideJar - the resource file name of the file inside the jar
alternativeDirectoryPath - the directory path used if the file cannot be found within the jar; if set to null, this argument is ignored
copyFile - the file that will be the copy of the original one
Returns:
true if the copy was OK
See Also:
copyInputStreamIntoFile(java.io.InputStream, java.io.File)

copyInputStreamIntoFile

public static boolean copyInputStreamIntoFile(java.io.InputStream inputStream,
                                              java.io.File copyFile)
Copies the content of the input stream into the given file. If the directory path to the new file does not exist, it is created.
Parameters:
inputStream - the input stream, from which the data are copied; note that the input stream will be closed if this method returns true. The special cas when it is null is also handled
copyFile - the file in which the content of the input stream should be copied
Returns:
true if no problem during the copy occured


Copyright © 2004-2005 SourceForge. All Rights Reserved.