org.eclipse.jdt.ui.jarpackager
Class JarWriter3
java.lang.Object
org.eclipse.jdt.ui.jarpackager.JarWriter3
-
public class JarWriter3
- extends
Object
Creates a JAR file for the given JAR package data.
Clients may subclass.
-
Since:
- 3.2
-
See Also:
-
JarPackageData
Constructor Summary
|
JarWriter3
(
JarPackageData jarPackage,
Shell parent)
Creates an instance which is used to create a JAR based
on the given JarPackage. |
Method Summary
|
protected void
|
addDirectories
(
IPath destinationPath)
Creates the directory entries for the given path and writes it to the current archive. |
protected void
|
addDirectories
(
IResource resource,
IPath destinationPath)
Creates the directory entries for the given path and writes it to the
current archive. |
protected void
|
addDirectories
(
String destPath)
Creates the directory entries for the given path and writes it to the current archive. |
protected void
|
addEntry
(
JarEntry entry,
InputStream content)
Write the given entry describing the given content to the
current archive |
protected void
|
addFile
(
IFile resource,
IPath path)
Creates a new JarEntry with the passed path and contents, and writes it
to the current archive. |
protected boolean
|
canCreateJar
(
Shell parent)
Checks if the JAR file can be overwritten. |
void
|
close
()
Closes the archive and does all required cleanup. |
void
|
write
(
IFile resource,
IPath destinationPath)
Writes the passed resource to the current archive. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
JarWriter3
public JarWriter3(
JarPackageData jarPackage,
Shell parent)
throws
CoreException
- Creates an instance which is used to create a JAR based
on the given JarPackage.
-
Parameters:
-
jarPackage
- the JAR specification -
parent
- the shell used to display question dialogs,
or null
if "false/no/cancel" is the answer
and no dialog should be shown
-
Throws:
-
CoreException
- to signal any other unusual termination.
This can also be used to return information
in the status object.
addDirectories
protected void addDirectories(
IPath destinationPath)
throws
IOException
- Creates the directory entries for the given path and writes it to the current archive.
-
-
Parameters:
-
destinationPath
- the path to add
-
Throws:
-
IOException
- if an I/O error has occurred
addDirectories
protected void addDirectories(
String destPath)
throws
IOException
- Creates the directory entries for the given path and writes it to the current archive.
-
-
Parameters:
-
destPath
- the path to add
-
Throws:
-
IOException
- if an I/O error has occurred -
Since:
- 3.5
addDirectories
protected void addDirectories(
IResource resource,
IPath destinationPath)
throws
IOException,
CoreException
- Creates the directory entries for the given path and writes it to the
current archive.
-
-
Parameters:
-
resource
- the resource for which the parent directories are to be added -
destinationPath
- the path to add
-
Throws:
-
IOException
- if an I/O error has occurred
-
CoreException
- if accessing the resource failes
addFile
protected void addFile(
IFile resource,
IPath path)
throws
IOException,
CoreException
- Creates a new JarEntry with the passed path and contents, and writes it
to the current archive.
-
-
Parameters:
-
resource
- the file to write -
path
- the path inside the archive
-
Throws:
-
IOException
- if an I/O error has occurred
-
CoreException
- if the resource can-t be accessed
addEntry
protected void addEntry(
JarEntry entry,
InputStream content)
throws
IOException
- Write the given entry describing the given content to the
current archive
-
-
Parameters:
-
entry
- the entry to write -
content
- the content to write
-
Throws:
-
IOException
- If an I/O error occurred -
Since:
- 3.4
canCreateJar
protected boolean canCreateJar(
Shell parent)
- Checks if the JAR file can be overwritten.
If the JAR package setting does not allow to overwrite the JAR
then a dialog will ask the user again.
-
-
Parameters:
-
parent
- the parent for the dialog,
or null
if no dialog should be presented
-
Returns:
-
true
if it is OK to create the JAR
close
public void close()
throws
CoreException
- Closes the archive and does all required cleanup.
-
-
Throws:
-
CoreException
- to signal any other unusual termination. This can also be
used to return information in the status object.
write
public void write(
IFile resource,
IPath destinationPath)
throws
CoreException
- Writes the passed resource to the current archive.
-
-
Parameters:
-
resource
- the file to be written -
destinationPath
- the path for the file inside the archive
-
Throws:
-
CoreException
- to signal any other unusual termination. This can also be
used to return information in the status object.
Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.