Class JarWriter

java.lang.Object
org.eclipse.jdt.ui.jarpackager.JarWriter

@Deprecated(forRemoval=true, since="2024-12") public class JarWriter extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
use JarWriter3 instead.
Creates a JAR file for the given JAR package data. Clients may subclass.
Since:
2.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    JarWriter(JarPackageData jarPackage, org.eclipse.swt.widgets.Shell parent)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an instance which is used to create a JAR based on the given JarPackage.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    canCreateJar(org.eclipse.swt.widgets.Shell parent)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Checks if the JAR file can be overwritten.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Closes the archive and does all required cleanup.
    void
    write(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath destinationPath)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Writes the passed resource to the current archive.
    protected void
    write(org.eclipse.core.runtime.IPath path, byte[] contents, long lastModified)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new JarEntry with the passed path and contents, and writes it to the current archive.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JarWriter

      public JarWriter(JarPackageData jarPackage, org.eclipse.swt.widgets.Shell parent) throws org.eclipse.core.runtime.CoreException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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:
      org.eclipse.core.runtime.CoreException - to signal any other unusual termination. This can also be used to return information in the status object.
  • Method Details

    • close

      public void close() throws org.eclipse.core.runtime.CoreException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Closes the archive and does all required cleanup.
      Throws:
      org.eclipse.core.runtime.CoreException - to signal any other unusual termination. This can also be used to return information in the status object.
    • write

      public void write(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath destinationPath) throws org.eclipse.core.runtime.CoreException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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:
      org.eclipse.core.runtime.CoreException - to signal any other unusual termination. This can also be used to return information in the status object.
    • write

      protected void write(org.eclipse.core.runtime.IPath path, byte[] contents, long lastModified) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new JarEntry with the passed path and contents, and writes it to the current archive.
      Parameters:
      path - the path inside the archive
      contents - the bytes to write
      lastModified - a long which represents the last modification date
      Throws:
      IOException - if an I/O error has occurred
    • canCreateJar

      protected boolean canCreateJar(org.eclipse.swt.widgets.Shell parent)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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