public class JarWriter3 extends Object
Clients may subclass.
JarPackageData
Constructor and Description |
---|
JarWriter3(JarPackageData jarPackage,
Shell parent)
Creates an instance which is used to create a JAR based
on the given JarPackage.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public JarWriter3(JarPackageData jarPackage, Shell parent) throws CoreException
jarPackage
- the JAR specificationparent
- the shell used to display question dialogs,
or null
if "false/no/cancel" is the answer
and no dialog should be shownCoreException
- to signal any other unusual termination.
This can also be used to return information
in the status object.protected void addDirectories(IPath destinationPath) throws IOException
destinationPath
- the path to addIOException
- if an I/O error has occurredprotected void addDirectories(String destPath) throws IOException
destPath
- the path to addIOException
- if an I/O error has occurredprotected void addDirectories(IResource resource, IPath destinationPath) throws IOException, CoreException
resource
- the resource for which the parent directories are to be addeddestinationPath
- the path to addIOException
- if an I/O error has occurredCoreException
- if accessing the resource failesprotected void addFile(IFile resource, IPath path) throws IOException, CoreException
resource
- the file to writepath
- the path inside the archiveIOException
- if an I/O error has occurredCoreException
- if the resource can-t be accessedprotected void addEntry(JarEntry entry, InputStream content) throws IOException
entry
- the entry to writecontent
- the content to writeIOException
- If an I/O error occurredprotected boolean canCreateJar(Shell parent)
parent
- the parent for the dialog,
or null
if no dialog should be presentedtrue
if it is OK to create the JARpublic void close() throws CoreException
CoreException
- to signal any other unusual termination. This can also be
used to return information in the status object.public void write(IFile resource, IPath destinationPath) throws CoreException
resource
- the file to be writtendestinationPath
- the path for the file inside the archiveCoreException
- to signal any other unusual termination. This can also be
used to return information in the status object.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.