close() public method

public close ( ) : void
return void
Ejemplo n.º 1
0
 private static void AddEntries(java.util.zip.ZipFile file, string rootDirectory, string[] newFiles, bool flattenHierarchy)
 {
     string destFileName = file.getName();
     string tempFileName = Path.GetTempFileName();
     ZipOutputStream destination = new ZipOutputStream(new FileOutputStream(tempFileName));
     try
     {
         CopyEntries(file, destination);
         if (newFiles != null)
         {
             foreach (string str3 in newFiles)
             {
                 string directoryName;
                 if (flattenHierarchy)
                 {
                     directoryName = Path.GetDirectoryName(str3);
                 }
                 else if (rootDirectory == null)
                 {
                     directoryName = Path.GetPathRoot(str3);
                 }
                 else
                 {
                     directoryName = rootDirectory;
                 }
                 directoryName = directoryName + @"\";
                 ZipEntry ze = new ZipEntry(str3.Remove(0, directoryName.Length));
                 ze.setMethod(8);
                 destination.putNextEntry(ze);
                 try
                 {
                     FileInputStream source = new FileInputStream(str3);
                     try
                     {
                         CopyStream(source, destination);
                     }
                     finally
                     {
                         source.close();
                     }
                 }
                 finally
                 {
                     destination.closeEntry();
                 }
             }
         }
     }
     finally
     {
         destination.close();
     }
     file.close();
     System.IO.File.Copy(tempFileName, destFileName, true);
     System.IO.File.Delete(tempFileName);
 }
Ejemplo n.º 2
0
 private static void RemoveEntries(java.util.zip.ZipFile file, string[] items)
 {
     string destFileName = file.getName();
     string tempFileName = Path.GetTempFileName();
     ZipOutputStream destination = new ZipOutputStream(new FileOutputStream(tempFileName));
     try
     {
         List<ZipEntry> zippedItems = GetZippedItems(file);
         List<string> list2 = new List<string>();
         foreach (ZipEntry entry in zippedItems)
         {
             bool flag = false;
             foreach (string str3 in items)
             {
                 if (str3 != entry.getName())
                 {
                     flag = true;
                 }
             }
             if (flag)
             {
                 list2.Add(entry.getName());
             }
         }
         CopyEntries(file, destination, list2.ToArray());
     }
     finally
     {
         destination.close();
     }
     file.close();
     System.IO.File.Copy(tempFileName, destFileName, true);
     System.IO.File.Delete(tempFileName);
 }