org.eclipse.equinox.p2.core_2.2.0.v20120430-0525

ourcePath.setDevice(null);
  }
  
  public void reset() {}
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.FileUtils.4
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.File;
import org.eclipse.core.runtime.IPath;

public abstract interface FileUtils$IPathComputer
{
  public abstract IPath computePath(File paramFile);
  
  public abstract void reset();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.FileUtils.IPathComputer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;

public class FileUtils
{
  /* Error */
  private static File[] untarFile(File source, File outputDir)
    throws IOException, TarException
  {
    // Byte code:
    //   0: new 207	org/eclipse/equinox/internal/p2/core/helpers/TarFile
    //   3: dup
    //   4: aload_0
    //   5: invokespecial 423	org/eclipse/equinox/internal/p2/core/helpers/TarFile:<init>	(Ljava/io/File;)V
    //   8: astore_2
    //   9: new 186	java/util/ArrayList
    //   12: dup
    //   13: invokespecial 383	java/util/ArrayList:<init>	()V
    //   16: astore_3
    //   17: aload_2
    //   18: invokevirtual 424	org/eclipse/equinox/internal/p2/core/helpers/TarFile:entries	()Ljava/util/Enumeration;
    //   21: astore 4
    //   23: goto +149 -> 172
    //   26: aload 4
    //   28: invokeinterface 428 1 0
    //   33: checkcast 205	org/eclipse/equinox/internal/p2/core/helpers/TarEntry
    //   36: astore 5
    //   38: aload_2
    //   39: aload 5
    //   41: invokevirtual 425	org/eclipse/equinox/internal/p2/core/helpers/TarFile:getInputStream	(Lorg/eclipse/equinox/internal/p2/core/helpers/TarEntry;)Ljava/io/InputStream;
    //   44: astore 6
    //   46: new 176	java/io/File
    //   49: dup
    //   50: aload_1
    //   51: aload 5
    //   53: invokevirtual 420	org/eclipse/equinox/internal/p2/core/helpers/TarEntry:getName	()Ljava/lang/String;
    //   56: invokespecial 363	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   59: astore 7
    //   61: aload 7
    //   63: invokevirtual 358	java/io/File:getCanonicalFile	()Ljava/io/File;
    //   66: astore 7
    //   68: aload_3
    //   69: aload 7
    //   71: invokeinterface 430 2 0
    //   76: pop
    //   77: aload 5
    //   79: invokevirtual 418	org/eclipse/equinox/internal/p2/core/helpers/TarEntry:getFileType	()I
    //   82: bipush 53
    //   84: if_icmpne +12 -> 96
    //   87: aload 7
    //   89: invokevirtual 356	java/io/File:mkdirs	()Z
    //   92: pop
    //   93: goto +74 -> 167
    //   96: aload 7
    //   98: invokevirtual 354	java/io/File:exists	()Z
    //   101: ifeq +12 -> 113
    //   104: aload 7
    //   106: invokevirtual 353	java/io/File:delete	()Z
    //   109: pop
    //   110: goto +12 -> 122
    //   113: aload 7
    //   115: invokevirtual 359	java/io/File:getParentFile	()Ljava/io/File;
    //   118: invokevirtual 356	java/io/File:mkdirs	()Z
    //   121: pop
    //   122: aload 6
    //   124: iconst_0
    //   125: new 179	java/io/FileOutputStream
    //   128: dup
    //   129: aload 7
    //   131: invokespecial 367	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   134: iconst_1
    //   135: invokestatic 406	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:copyStream	(Ljava/io/InputStream;ZLjava/io/OutputStream;Z)I
    //   138: pop
    //   139: goto +4 -> 143
    //   142: pop
    //   143: aload 7
    //   145: aload 5
    //   147: invokevirtual 419	org/eclipse/equinox/internal/p2/core/helpers/TarEntry:getTime	()J
    //   150: invokevirtual 357	java/io/File:setLastModified	(J)Z
    //   153: pop
    //   154: goto +13 -> 167
    //   157: astore 8
    //   159: aload 6
    //   161: invokevirtual 370	java/io/InputStream:close	()V
    //   164: aload 8
    //   166: athrow
    //   167: aload 6
    //   169: invokevirtual 370	java/io/InputStream:close	()V
    //   172: aload 4
    //   174: invokeinterface 427 1 0
    //   179: ifne -153 -> 26
    //   182: goto +12 -> 194
    //   185: astore 9
    //   187: aload_2
    //   188: invokevirtual 422	org/eclipse/equinox/internal/p2/core/helpers/TarFile:close	()V
    //   191: aload 9
    //   193: athrow
    //   194: aload_2
    //   195: invokevirtual 422	org/eclipse/equinox/internal/p2/core/helpers/TarFile:close	()V
    //   198: aload_3
    //   199: aload_3
    //   200: invokeinterface 429 1 0
    //   205: anewarray 176	java/io/File
    //   208: invokeinterface 431 2 0
    //   213: checkcast 173	[Ljava/io/File;
    //   216: areturn
    // Line number table:
    //   Java source line #23	-> byte code offset #0
    //   Java source line #24	-> byte code offset #9
    //   Java source line #26	-> byte code offset #17
    //   Java source line #27	-> byte code offset #26
    //   Java source line #28	-> byte code offset #38
    //   Java source line #30	-> byte code offset #46
    //   Java source line #31	-> byte code offset #61
    //   Java source line #32	-> byte code offset #68
    //   Java source line #33	-> byte code offset #77
    //   Java source line #34	-> byte code offset #87
    //   Java source line #36	-> byte code offset #96
    //   Java source line #37	-> byte code offset #104
    //   Java source line #39	-> byte code offset #113
    //   Java source line #41	-> byte code offset #122
    //   Java source line #42	-> byte code offset #142
    //   Java source line #46	-> byte code offset #143
    //   Java source line #48	-> byte code offset #157
    //   Java source line #49	-> byte code offset #159
    //   Java source line #50	-> byte code offset #164
    //   Java source line #49	-> byte code offset #167
    //   Java source line #26	-> byte code offset #172
    //   Java source line #52	-> byte code offset #185
    //   Java source line #53	-> byte code offset #187
    //   Java source line #54	-> byte code offset #191
    //   Java source line #53	-> byte code offset #194
    //   Java source line #55	-> byte code offset #198
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	217	0	source	File
    //   0	217	1	outputDir	File
    //   8	187	2	tarFile	TarFile
    //   16	184	3	untarredFiles	java.util.List<File>
    //   21	152	4	e	java.util.Enumeration<TarEntry>
    //   36	110	5	entry	TarEntry
    //   44	124	6	input	InputStream
    //   59	85	7	outFile	File
    //   157	8	8	localObject1	Object
    //   185	7	9	localObject2	Object
    //   142	1	10	localFileNotFoundException	FileNotFoundException
    // Exception table:
    //   from	to	target	type
    //   122	139	142	java/io/FileNotFoundException
    //   46	157	157	finally
    //   17	185	185	finally
  }
  
  public static File[] unzipFile(File zipFile, File outputDir)
    throws IOException
  {
    if (zipFile.getName().toLowerCase().endsWith(".tar.gz")) {
      try
      {
        return untarFile(zipFile, outputDir);
      }
      catch (TarException e)
      {
        throw new IOException(e.getMessage());
      }
    }
    InputStream in = new FileInputStream(zipFile);
    try
    {
      return unzipStream(in, zipFile.length(), outputDir, null, null);
    }
    catch (IOException e)
    {
      throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
    }
    finally
    {
      in.close();
    }
  }
  
  public static File[] unzipFile(File zipFile, File outputDir, String taskName, IProgressMonitor monitor)
    throws IOException
  {
    InputStream in = new FileInputStream(zipFile);
    try
    {
      return unzipStream(in, zipFile.length(), outputDir, taskName, monitor);
    }
    catch (IOException e)
    {
      throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
    }
    finally
    {
      in.close();
    }
  }
  
  public static File[] unzipStream(InputStream stream, long size, File outputDir, String taskName, IProgressMonitor monitor)
    throws IOException
  {
    InputStream is = monitor == null ? stream : stream;
    ZipInputStream in = new ZipInputStream(new BufferedInputStream(is));
    ZipEntry ze = in.getNextEntry();
    if (ze == null)
    {
      in.close();
      throw new IOException(Messages.Util_Invalid_Zip_File_Format);
    }
    ArrayList<File> unzippedFiles = new ArrayList();
    do
    {
      File outFile = new File(outputDir, ze.getName());
      unzippedFiles.add(outFile);
      if (ze.isDirectory())
      {
        outFile.mkdirs();
      }
      else
      {
        if (outFile.exists()) {
          outFile.delete();
        } else {
          outFile.getParentFile().mkdirs();
        }
        try
        {
          copyStream(in, false, new FileOutputStream(outFile), true);
        }
        catch (FileNotFoundException localFileNotFoundException) {}
        outFile.setLastModified(ze.getTime());
      }
      in.closeEntry();
    } while ((ze = in.getNextEntry()) != null);
    in.close();
    
    return (File[])unzippedFiles.toArray(new File[unzippedFiles.size()]);
  }
  
  public static void deleteEmptyDirs(File dir)
    throws IOException
  {
    File[] files = dir.listFiles();
    if (files != null)
    {
      for (int i = 0; i < files.length; i++) {
        deleteEmptyDirs(files[i]);
      }
      dir.getCanonicalFile().delete();
    }
  }
  
  public static void deleteAll(File file)
  {
    if (!file.exists()) {
      return;
    }
    if (file.isDirectory())
    {
      File[] files = file.listFiles();
      if (files != null) {
        for (int i = 0; i < files.length; i++) {
          deleteAll(files[i]);
        }
      }
    }
    file.delete();
  }
  
  /* Error */
  public static int copyStream(InputStream in, boolean closeIn, java.io.OutputStream out, boolean closeOut)
    throws IOException
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore 4
    //   3: sipush 16384
    //   6: newarray <illegal type>
    //   8: astore 5
    //   10: goto +19 -> 29
    //   13: aload_2
    //   14: aload 5
    //   16: iconst_0
    //   17: iload 6
    //   19: invokevirtual 373	java/io/OutputStream:write	([BII)V
    //   22: iload 4
    //   24: iload 6
    //   26: iadd
    //   27: istore 4
    //   29: aload_0
    //   30: aload 5
    //   32: invokevirtual 371	java/io/InputStream:read	([B)I
    //   35: dup
    //   36: istore 6
    //   38: iconst_m1
    //   39: if_icmpne -26 -> 13
    //   42: iload 4
    //   44: istore 8
    //   46: iload_1
    //   47: ifeq +23 -> 70
    //   50: aload_0
    //   51: invokevirtual 370	java/io/InputStream:close	()V
    //   54: goto +16 -> 70
    //   57: astore 9
    //   59: iload_3
    //   60: ifeq +7 -> 67
    //   63: aload_2
    //   64: invokevirtual 372	java/io/OutputStream:close	()V
    //   67: aload 9
    //   69: athrow
    //   70: iload_3
    //   71: ifeq +7 -> 78
    //   74: aload_2
    //   75: invokevirtual 372	java/io/OutputStream:close	()V
    //   78: iload 8
    //   80: ireturn
    //   81: astore 7
    //   83: iload_1
    //   84: ifeq +23 -> 107
    //   87: aload_0
    //   88: invokevirtual 370	java/io/InputStream:close	()V
    //   91: goto +16 -> 107
    //   94: astore 9
    //   96: iload_3
    //   97: ifeq +7 -> 104
    //   100: aload_2
    //   101: invokevirtual 372	java/io/OutputStream:close	()V
    //   104: aload 9
    //   106: athrow
    //   107: iload_3
    //   108: ifeq +7 -> 115
    //   111: aload_2
    //   112: invokevirtual 372	java/io/OutputStream:close	()V
    //   115: aload 7
    //   117: athrow
    // Line number table:
    //   Java source line #168	-> byte code offset #0
    //   Java source line #169	-> byte code offset #3
    //   Java source line #171	-> byte code offset #10
    //   Java source line #172	-> byte code offset #13
    //   Java source line #173	-> byte code offset #22
    //   Java source line #171	-> byte code offset #29
    //   Java source line #175	-> byte code offset #42
    //   Java source line #178	-> byte code offset #46
    //   Java source line #179	-> byte code offset #50
    //   Java source line #181	-> byte code offset #57
    //   Java source line #182	-> byte code offset #59
    //   Java source line #183	-> byte code offset #63
    //   Java source line #185	-> byte code offset #67
    //   Java source line #182	-> byte code offset #70
    //   Java source line #183	-> byte code offset #74
    //   Java source line #175	-> byte code offset #78
    //   Java source line #176	-> byte code offset #81
    //   Java source line #178	-> byte code offset #83
    //   Java source line #179	-> byte code offset #87
    //   Java source line #181	-> byte code offset #94
    //   Java source line #182	-> byte code offset #96
    //   Java source line #183	-> byte code offset #100
    //   Java source line #185	-> byte code offset #104
    //   Java source line #182	-> byte code offset #107
    //   Java source line #183	-> byte code offset #111
    //   Java source line #186	-> byte code offset #115
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	118	0	in	InputStream
    //   0	118	1	closeIn	boolean
    //   0	118	2	out	java.io.OutputStream
    //   0	118	3	closeOut	boolean
    //   1	42	4	written	int
    //   8	23	5	buffer	byte[]
    //   13	12	6	len	int
    //   36	3	6	len	int
    //   81	35	7	localObject1	Object
    //   44	35	8	i	int
    //   57	11	9	localObject2	Object
    //   94	11	9	localObject3	Object
    // Exception table:
    //   from	to	target	type
    //   46	57	57	finally
    //   0	46	81	finally
    //   83	94	94	finally
  }
  
  /* Error */
  public static void copy(File source, File destination, File root, boolean overwrite)
    throws IOException
  {
    // Byte code:
    //   0: new 176	java/io/File
    //   3: dup
    //   4: aload_0
    //   5: aload_2
    //   6: invokevirtual 362	java/io/File:getPath	()Ljava/lang/String;
    //   9: invokespecial 363	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   12: astore 4
    //   14: aload 4
    //   16: invokevirtual 354	java/io/File:exists	()Z
    //   19: ifne +35 -> 54
    //   22: new 178	java/io/FileNotFoundException
    //   25: dup
    //   26: new 185	java/lang/StringBuffer
    //   29: dup
    //   30: ldc_w 172
    //   33: invokespecial 379	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   36: aload 4
    //   38: invokevirtual 380	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   41: ldc_w 168
    //   44: invokevirtual 381	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   47: invokevirtual 378	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   50: invokespecial 365	java/io/FileNotFoundException:<init>	(Ljava/lang/String;)V
    //   53: athrow
    //   54: new 176	java/io/File
    //   57: dup
    //   58: aload_1
    //   59: aload_2
    //   60: invokevirtual 362	java/io/File:getPath	()Ljava/lang/String;
    //   63: invokespecial 363	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   66: astore 5
    //   68: aload 5
    //   70: invokevirtual 354	java/io/File:exists	()Z
    //   73: ifeq +47 -> 120
    //   76: iload_3
    //   77: ifeq +11 -> 88
    //   80: aload 5
    //   82: invokestatic 404	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:deleteAll	(Ljava/io/File;)V
    //   85: goto +35 -> 120
    //   88: new 180	java/io/IOException
    //   91: dup
    //   92: new 185	java/lang/StringBuffer
    //   95: dup
    //   96: ldc_w 169
    //   99: invokespecial 379	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   102: aload 5
    //   104: invokevirtual 380	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   107: ldc_w 167
    //   110: invokevirtual 381	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   113: invokevirtual 378	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   116: invokespecial 369	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   119: athrow
    //   120: aload 4
    //   122: invokevirtual 355	java/io/File:isDirectory	()Z
    //   125: ifeq +58 -> 183
    //   128: aload 5
    //   130: invokevirtual 356	java/io/File:mkdirs	()Z
    //   133: pop
    //   134: aload 4
    //   136: invokevirtual 360	java/io/File:listFiles	()[Ljava/io/File;
    //   139: astore 6
    //   141: iconst_0
    //   142: istore 7
    //   144: goto +28 -> 172
    //   147: aload_0
    //   148: aload_1
    //   149: new 176	java/io/File
    //   152: dup
    //   153: aload_2
    //   154: aload 6
    //   156: iload 7
    //   158: aaload
    //   159: invokevirtual 361	java/io/File:getName	()Ljava/lang/String;
    //   162: invokespecial 363	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   165: iconst_0
    //   166: invokestatic 408	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:copy	(Ljava/io/File;Ljava/io/File;Ljava/io/File;Z)V
    //   169: iinc 7 1
    //   172: iload 7
    //   174: aload 6
    //   176: arraylength
    //   177: if_icmplt -30 -> 147
    //   180: goto +148 -> 328
    //   183: aload 5
    //   185: invokevirtual 359	java/io/File:getParentFile	()Ljava/io/File;
    //   188: invokevirtual 356	java/io/File:mkdirs	()Z
    //   191: pop
    //   192: aconst_null
    //   193: astore 6
    //   195: aconst_null
    //   196: astore 7
    //   198: new 174	java/io/BufferedInputStream
    //   201: dup
    //   202: new 177	java/io/FileInputStream
    //   205: dup
    //   206: aload 4
    //   208: invokespecial 364	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   211: invokespecial 349	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   214: astore 6
    //   216: new 175	java/io/BufferedOutputStream
    //   219: dup
    //   220: new 179	java/io/FileOutputStream
    //   223: dup
    //   224: aload 5
    //   226: invokespecial 367	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   229: invokespecial 350	java/io/BufferedOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   232: astore 7
    //   234: aload 6
    //   236: iconst_0
    //   237: aload 7
    //   239: iconst_0
    //   240: invokestatic 406	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:copyStream	(Ljava/io/InputStream;ZLjava/io/OutputStream;Z)I
    //   243: pop
    //   244: goto +46 -> 290
    //   247: astore 8
    //   249: aload 6
    //   251: ifnull +26 -> 277
    //   254: aload 6
    //   256: invokevirtual 370	java/io/InputStream:close	()V
    //   259: goto +18 -> 277
    //   262: astore 9
    //   264: aload 7
    //   266: ifnull +8 -> 274
    //   269: aload 7
    //   271: invokevirtual 372	java/io/OutputStream:close	()V
    //   274: aload 9
    //   276: athrow
    //   277: aload 7
    //   279: ifnull +8 -> 287
    //   282: aload 7
    //   284: invokevirtual 372	java/io/OutputStream:close	()V
    //   287: aload 8
    //   289: athrow
    //   290: aload 6
    //   292: ifnull +26 -> 318
    //   295: aload 6
    //   297: invokevirtual 370	java/io/InputStream:close	()V
    //   300: goto +18 -> 318
    //   303: astore 9
    //   305: aload 7
    //   307: ifnull +8 -> 315
    //   310: aload 7
    //   312: invokevirtual 372	java/io/OutputStream:close	()V
    //   315: aload 9
    //   317: athrow
    //   318: aload 7
    //   320: ifnull +8 -> 328
    //   323: aload 7
    //   325: invokevirtual 372	java/io/OutputStream:close	()V
    //   328: return
    // Line number table:
    //   Java source line #190	-> byte code offset #0
    //   Java source line #191	-> byte code offset #14
    //   Java source line #192	-> byte code offset #22
    //   Java source line #194	-> byte code offset #54
    //   Java source line #196	-> byte code offset #68
    //   Java source line #197	-> byte code offset #76
    //   Java source line #198	-> byte code offset #80
    //   Java source line #200	-> byte code offset #88
    //   Java source line #201	-> byte code offset #120
    //   Java source line #202	-> byte code offset #128
    //   Java source line #203	-> byte code offset #134
    //   Java source line #204	-> byte code offset #141
    //   Java source line #205	-> byte code offset #147
    //   Java source line #204	-> byte code offset #169
    //   Java source line #207	-> byte code offset #183
    //   Java source line #208	-> byte code offset #192
    //   Java source line #209	-> byte code offset #195
    //   Java source line #211	-> byte code offset #198
    //   Java source line #212	-> byte code offset #216
    //   Java source line #213	-> byte code offset #234
    //   Java source line #214	-> byte code offset #247
    //   Java source line #216	-> byte code offset #249
    //   Java source line #217	-> byte code offset #254
    //   Java source line #218	-> byte code offset #262
    //   Java source line #219	-> byte code offset #264
    //   Java source line #220	-> byte code offset #269
    //   Java source line #221	-> byte code offset #274
    //   Java source line #219	-> byte code offset #277
    //   Java source line #220	-> byte code offset #282
    //   Java source line #222	-> byte code offset #287
    //   Java source line #216	-> byte code offset #290
    //   Java source line #217	-> byte code offset #295
    //   Java source line #218	-> byte code offset #303
    //   Java source line #219	-> byte code offset #305
    //   Java source line #220	-> byte code offset #310
    //   Java source line #221	-> byte code offset #315
    //   Java source line #219	-> byte code offset #318
    //   Java source line #220	-> byte code offset #323
    //   Java source line #224	-> byte code offset #328
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	329	0	source	File
    //   0	329	1	destination	File
    //   0	329	2	root	File
    //   0	329	3	overwrite	boolean
    //   12	195	4	sourceFile	File
    //   66	159	5	destinationFile	File
    //   139	36	6	list	File[]
    //   193	103	6	in	InputStream
    //   142	31	7	i	int
    //   196	128	7	out	java.io.OutputStream
    //   247	41	8	localObject1	Object
    //   262	13	9	localObject2	Object
    //   303	13	9	localObject3	Object
    // Exception table:
    //   from	to	target	type
    //   198	247	247	finally
    //   249	262	262	finally
    //   290	303	303	finally
  }
  
  /* Error */
  public static void zip(File[] inclusions, File[] exclusions, File destinationArchive, IPathComputer pathComputer)
    throws IOException
  {
    // Byte code:
    //   0: new 179	java/io/FileOutputStream
    //   3: dup
    //   4: aload_2
    //   5: invokespecial 367	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   8: astore 4
    //   10: new 195	java/util/zip/ZipOutputStream
    //   13: dup
    //   14: aload 4
    //   16: invokespecial 401	java/util/zip/ZipOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   19: astore 5
    //   21: aload_1
    //   22: ifnonnull +13 -> 35
    //   25: new 189	java/util/HashSet
    //   28: dup
    //   29: invokespecial 388	java/util/HashSet:<init>	()V
    //   32: goto +14 -> 46
    //   35: new 189	java/util/HashSet
    //   38: dup
    //   39: aload_1
    //   40: invokestatic 387	java/util/Arrays:asList	([Ljava/lang/Object;)Ljava/util/List;
    //   43: invokespecial 389	java/util/HashSet:<init>	(Ljava/util/Collection;)V
    //   46: astore 6
    //   48: new 189	java/util/HashSet
    //   51: dup
    //   52: invokespecial 388	java/util/HashSet:<init>	()V
    //   55: astore 7
    //   57: iconst_0
    //   58: istore 8
    //   60: goto +26 -> 86
    //   63: aload_3
    //   64: invokeinterface 439 1 0
    //   69: aload 5
    //   71: aload_0
    //   72: iload 8
    //   74: aaload
    //   75: aload 6
    //   77: aload_3
    //   78: aload 7
    //   80: invokestatic 412	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:zip	(Ljava/util/zip/ZipOutputStream;Ljava/io/File;Ljava/util/Set;Lorg/eclipse/equinox/internal/p2/core/helpers/FileUtils$IPathComputer;Ljava/util/Set;)V
    //   83: iinc 8 1
    //   86: iload 8
    //   88: aload_0
    //   89: arraylength
    //   90: if_icmplt -27 -> 63
    //   93: goto +26 -> 119
    //   96: astore 9
    //   98: aload 5
    //   100: invokevirtual 399	java/util/zip/ZipOutputStream:close	()V
    //   103: goto +13 -> 116
    //   106: pop
    //   107: aload 4
    //   109: invokevirtual 366	java/io/FileOutputStream:close	()V
    //   112: goto +4 -> 116
    //   115: pop
    //   116: aload 9
    //   118: athrow
    //   119: aload 5
    //   121: invokevirtual 399	java/util/zip/ZipOutputStream:close	()V
    //   124: goto +13 -> 137
    //   127: pop
    //   128: aload 4
    //   130: invokevirtual 366	java/io/FileOutputStream:close	()V
    //   133: goto +4 -> 137
    //   136: pop
    //   137: return
    // Line number table:
    //   Java source line #244	-> byte code offset #0
    //   Java source line #245	-> byte code offset #10
    //   Java source line #246	-> byte code offset #21
    //   Java source line #247	-> byte code offset #48
    //   Java source line #249	-> byte code offset #57
    //   Java source line #250	-> byte code offset #63
    //   Java source line #251	-> byte code offset #69
    //   Java source line #249	-> byte code offset #83
    //   Java source line #253	-> byte code offset #96
    //   Java source line #255	-> byte code offset #98
    //   Java source line #256	-> byte code offset #106
    //   Java source line #260	-> byte code offset #107
    //   Java source line #261	-> byte code offset #115
    //   Java source line #265	-> byte code offset #116
    //   Java source line #255	-> byte code offset #119
    //   Java source line #256	-> byte code offset #127
    //   Java source line #260	-> byte code offset #128
    //   Java source line #261	-> byte code offset #136
    //   Java source line #266	-> byte code offset #137
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	138	0	inclusions	File[]
    //   0	138	1	exclusions	File[]
    //   0	138	2	destinationArchive	File
    //   0	138	3	pathComputer	IPathComputer
    //   8	121	4	fileOutput	FileOutputStream
    //   19	101	5	output	ZipOutputStream
    //   46	30	6	exclusionSet	HashSet<File>
    //   55	24	7	directoryEntries	HashSet<IPath>
    //   58	29	8	i	int
    //   96	21	9	localObject	Object
    //   106	1	10	localIOException1	IOException
    //   115	1	11	localIOException2	IOException
    //   127	1	12	localIOException3	IOException
    //   136	1	13	localIOException4	IOException
    // Exception table:
    //   from	to	target	type
    //   57	96	96	finally
    //   98	103	106	java/io/IOException
    //   107	112	115	java/io/IOException
    //   119	124	127	java/io/IOException
    //   128	133	136	java/io/IOException
  }
  
  public static void zip(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer)
    throws IOException
  {
    zip(output, source, exclusions, pathComputer, new HashSet());
  }
  
  public static void zip(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries)
    throws IOException
  {
    if (exclusions.contains(source)) {
      return;
    }
    if (source.isDirectory()) {
      zipDir(output, source, exclusions, pathComputer, directoryEntries);
    } else {
      zipFile(output, source, pathComputer, directoryEntries);
    }
  }
  
  /* Error */
  private static void zipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set<IPath> directoryEntries)
    throws IOException
  {
    // Byte code:
    //   0: aload_1
    //   1: invokeinterface 437 1 0
    //   6: astore_1
    //   7: aload 4
    //   9: aload_1
    //   10: invokeinterface 433 2 0
    //   15: ifne +99 -> 114
    //   18: aload_1
    //   19: invokeinterface 434 1 0
    //   24: iconst_1
    //   25: if_icmple +17 -> 42
    //   28: aload_0
    //   29: aload_1
    //   30: iconst_1
    //   31: invokeinterface 438 2 0
    //   36: lload_2
    //   37: aload 4
    //   39: invokestatic 409	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:zipDirectoryEntry	(Ljava/util/zip/ZipOutputStream;Lorg/eclipse/core/runtime/IPath;JLjava/util/Set;)V
    //   42: new 192	java/util/zip/ZipEntry
    //   45: dup
    //   46: aload_1
    //   47: invokeinterface 436 1 0
    //   52: invokespecial 394	java/util/zip/ZipEntry:<init>	(Ljava/lang/String;)V
    //   55: astore 5
    //   57: aload 5
    //   59: lload_2
    //   60: invokevirtual 392	java/util/zip/ZipEntry:setTime	(J)V
    //   63: aload_0
    //   64: aload 5
    //   66: invokevirtual 402	java/util/zip/ZipOutputStream:putNextEntry	(Ljava/util/zip/ZipEntry;)V
    //   69: aload 4
    //   71: aload_1
    //   72: invokeinterface 432 2 0
    //   77: pop
    //   78: goto +28 -> 106
    //   81: pop
    //   82: aload_0
    //   83: invokevirtual 400	java/util/zip/ZipOutputStream:closeEntry	()V
    //   86: goto +28 -> 114
    //   89: pop
    //   90: goto +24 -> 114
    //   93: astore 6
    //   95: aload_0
    //   96: invokevirtual 400	java/util/zip/ZipOutputStream:closeEntry	()V
    //   99: goto +4 -> 103
    //   102: pop
    //   103: aload 6
    //   105: athrow
    //   106: aload_0
    //   107: invokevirtual 400	java/util/zip/ZipOutputStream:closeEntry	()V
    //   110: goto +4 -> 114
    //   113: pop
    //   114: return
    // Line number table:
    //   Java source line #290	-> byte code offset #0
    //   Java source line #291	-> byte code offset #7
    //   Java source line #293	-> byte code offset #18
    //   Java source line #294	-> byte code offset #28
    //   Java source line #297	-> byte code offset #42
    //   Java source line #298	-> byte code offset #57
    //   Java source line #299	-> byte code offset #63
    //   Java source line #300	-> byte code offset #69
    //   Java source line #301	-> byte code offset #81
    //   Java source line #305	-> byte code offset #82
    //   Java source line #306	-> byte code offset #89
    //   Java source line #303	-> byte code offset #93
    //   Java source line #305	-> byte code offset #95
    //   Java source line #306	-> byte code offset #102
    //   Java source line #309	-> byte code offset #103
    //   Java source line #305	-> byte code offset #106
    //   Java source line #306	-> byte code offset #113
    //   Java source line #311	-> byte code offset #114
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	115	0	output	ZipOutputStream
    //   0	115	1	entry	IPath
    //   0	115	2	time	long
    //   0	115	4	directoryEntries	Set<IPath>
    //   55	10	5	dirEntry	ZipEntry
    //   81	1	6	localZipException	java.util.zip.ZipException
    //   93	11	6	localObject	Object
    //   89	1	7	localIOException1	IOException
    //   102	1	8	localIOException2	IOException
    //   113	1	9	localIOException3	IOException
    // Exception table:
    //   from	to	target	type
    //   42	78	81	java/util/zip/ZipException
    //   82	86	89	java/io/IOException
    //   42	82	93	finally
    //   95	99	102	java/io/IOException
    //   106	110	113	java/io/IOException
  }
  
  private static void zipDir(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries)
    throws IOException
  {
    File[] files = source.listFiles();
    if (files.length == 0) {
      zipDirectoryEntry(output, pathComputer.computePath(source), source.lastModified(), directoryEntries);
    }
    Arrays.sort(files, new Comparator()
    {
      public int compare(File arg0, File arg1)
      {
        Path a = new Path(arg0.getAbsolutePath());
        Path b = new Path(arg1.getAbsolutePath());
        if (a.segmentCount() == b.segmentCount())
        {
          if ((arg0.isDirectory()) && (arg1.isFile())) {
            return 1;
          }
          if ((arg0.isDirectory()) && (arg1.isDirectory())) {
            return 0;
          }
          if ((arg0.isFile()) && (arg1.isDirectory())) {
            return -1;
          }
          return 0;
        }
        return a.segmentCount() - b.segmentCount();
      }
    });
    for (int i = 0; i < files.length; i++) {
      zip(output, files[i], exclusions, pathComputer, directoryEntries);
    }
  }
  
  /* Error */
  private static void zipFile(ZipOutputStream output, File source, IPathComputer pathComputer, Set<IPath> directoryEntries)
    throws IOException
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore 4
    //   3: new 174	java/io/BufferedInputStream
    //   6: dup
    //   7: new 177	java/io/FileInputStream
    //   10: dup
    //   11: aload_1
    //   12: invokespecial 364	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   15: invokespecial 349	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   18: astore 5
    //   20: aload_2
    //   21: aload_1
    //   22: invokeinterface 440 2 0
    //   27: astore 6
    //   29: aload 6
    //   31: invokeinterface 435 1 0
    //   36: ifeq +14 -> 50
    //   39: new 180	java/io/IOException
    //   42: dup
    //   43: getstatic 345	org/eclipse/equinox/internal/p2/core/helpers/Messages:Util_Absolute_Entry	Ljava/lang/String;
    //   46: invokespecial 369	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   49: athrow
    //   50: aload 6
    //   52: invokeinterface 434 1 0
    //   57: ifne +14 -> 71
    //   60: new 180	java/io/IOException
    //   63: dup
    //   64: getstatic 346	org/eclipse/equinox/internal/p2/core/helpers/Messages:Util_Empty_Zip_Entry	Ljava/lang/String;
    //   67: invokespecial 369	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   70: athrow
    //   71: aload 6
    //   73: invokeinterface 434 1 0
    //   78: iconst_1
    //   79: if_icmple +40 -> 119
    //   82: ldc_w 171
    //   85: aload 6
    //   87: invokeinterface 436 1 0
    //   92: invokevirtual 375	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   95: istore 4
    //   97: iload 4
    //   99: ifne +20 -> 119
    //   102: aload_0
    //   103: aload 6
    //   105: iconst_1
    //   106: invokeinterface 438 2 0
    //   111: aload_1
    //   112: invokevirtual 351	java/io/File:lastModified	()J
    //   115: aload_3
    //   116: invokestatic 409	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:zipDirectoryEntry	(Ljava/util/zip/ZipOutputStream;Lorg/eclipse/core/runtime/IPath;JLjava/util/Set;)V
    //   119: new 192	java/util/zip/ZipEntry
    //   122: dup
    //   123: aload 6
    //   125: invokeinterface 436 1 0
    //   130: invokespecial 394	java/util/zip/ZipEntry:<init>	(Ljava/lang/String;)V
    //   133: astore 7
    //   135: aload 7
    //   137: aload_1
    //   138: invokevirtual 351	java/io/File:lastModified	()J
    //   141: invokevirtual 392	java/util/zip/ZipEntry:setTime	(J)V
    //   144: aload_0
    //   145: aload 7
    //   147: invokevirtual 402	java/util/zip/ZipOutputStream:putNextEntry	(Ljava/util/zip/ZipEntry;)V
    //   150: aload 5
    //   152: iconst_1
    //   153: aload_0
    //   154: iconst_0
    //   155: invokestatic 406	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:copyStream	(Ljava/io/InputStream;ZLjava/io/OutputStream;Z)I
    //   158: pop
    //   159: goto +46 -> 205
    //   162: pop
    //   163: aload 5
    //   165: invokevirtual 370	java/io/InputStream:close	()V
    //   168: goto +4 -> 172
    //   171: pop
    //   172: aload_0
    //   173: invokevirtual 400	java/util/zip/ZipOutputStream:closeEntry	()V
    //   176: goto +46 -> 222
    //   179: pop
    //   180: goto +42 -> 222
    //   183: astore 8
    //   185: aload 5
    //   187: invokevirtual 370	java/io/InputStream:close	()V
    //   190: goto +4 -> 194
    //   193: pop
    //   194: aload_0
    //   195: invokevirtual 400	java/util/zip/ZipOutputStream:closeEntry	()V
    //   198: goto +4 -> 202
    //   201: pop
    //   202: aload 8
    //   204: athrow
    //   205: aload 5
    //   207: invokevirtual 370	java/io/InputStream:close	()V
    //   210: goto +4 -> 214
    //   213: pop
    //   214: aload_0
    //   215: invokevirtual 400	java/util/zip/ZipOutputStream:closeEntry	()V
    //   218: goto +4 -> 222
    //   221: pop
    //   222: iload 4
    //   224: ifeq +22 -> 246
    //   227: aload_0
    //   228: new 197	org/eclipse/core/runtime/Path
    //   231: dup
    //   232: ldc_w 170
    //   235: invokespecial 403	org/eclipse/core/runtime/Path:<init>	(Ljava/lang/String;)V
    //   238: aload_1
    //   239: invokevirtual 351	java/io/File:lastModified	()J
    //   242: aload_3
    //   243: invokestatic 409	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:zipDirectoryEntry	(Ljava/util/zip/ZipOutputStream;Lorg/eclipse/core/runtime/IPath;JLjava/util/Set;)V
    //   246: return
    // Line number table:
    //   Java source line #356	-> byte code offset #0
    //   Java source line #357	-> byte code offset #3
    //   Java source line #359	-> byte code offset #20
    //   Java source line #360	-> byte code offset #29
    //   Java source line #361	-> byte code offset #39
    //   Java source line #362	-> byte code offset #50
    //   Java source line #363	-> byte code offset #60
    //   Java source line #366	-> byte code offset #71
    //   Java source line #368	-> byte code offset #82
    //   Java source line #369	-> byte code offset #97
    //   Java source line #370	-> byte code offset #102
    //   Java source line #373	-> byte code offset #119
    //   Java source line #374	-> byte code offset #135
    //   Java source line #375	-> byte code offset #144
    //   Java source line #376	-> byte code offset #150
    //   Java source line #377	-> byte code offset #162
    //   Java source line #381	-> byte code offset #163
    //   Java source line #382	-> byte code offset #171
    //   Java source line #386	-> byte code offset #172
    //   Java source line #387	-> byte code offset #179
    //   Java source line #379	-> byte code offset #183
    //   Java source line #381	-> byte code offset #185
    //   Java source line #382	-> byte code offset #193
    //   Java source line #386	-> byte code offset #194
    //   Java source line #387	-> byte code offset #201
    //   Java source line #390	-> byte code offset #202
    //   Java source line #381	-> byte code offset #205
    //   Java source line #382	-> byte code offset #213
    //   Java source line #386	-> byte code offset #214
    //   Java source line #387	-> byte code offset #221
    //   Java source line #392	-> byte code offset #222
    //   Java source line #393	-> byte code offset #227
    //   Java source line #395	-> byte code offset #246
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	247	0	output	ZipOutputStream
    //   0	247	1	source	File
    //   0	247	2	pathComputer	IPathComputer
    //   0	247	3	directoryEntries	Set<IPath>
    //   1	222	4	isManifest	boolean
    //   18	188	5	input	InputStream
    //   27	97	6	entryPath	IPath
    //   133	13	7	zipEntry	ZipEntry
    //   183	20	8	localObject	Object
    //   162	1	9	localZipException	java.util.zip.ZipException
    //   171	1	10	localIOException1	IOException
    //   179	1	11	localIOException2	IOException
    //   193	1	12	localIOException3	IOException
    //   201	1	13	localIOException4	IOException
    //   213	1	14	localIOExc
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd