Esempio n. 1
0
        /**
         * Adds an addition change.
         *
         * @param pChange
         *            the change which should result in an addition
         */
        private void addAddition(Change pChange)
        {
            if (Change.TYPE_ADD != pChange.type() ||
                pChange.getInput() == null)
            {
                return;
            }

            if (!changes.isEmpty())
            {
                for (java.util.Iterator <Change> it = changes.iterator(); it.hasNext();)
                {
                    Change change = it.next();
                    if (change.type() == Change.TYPE_ADD && change.getEntry() != null)
                    {
                        org.apache.commons.compress.archivers.ArchiveEntry entry = change.getEntry();
                        if (entry.equals(pChange.getEntry()))
                        {
                            if (pChange.isReplaceMode())
                            {
                                it.remove();
                                changes.add(pChange);
                                return;
                            }
                            else
                            {
                                // do not add this change
                                return;
                            }
                        }
                    }
                }
            }
            changes.add(pChange);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void loadEntry(java.nio.file.Path destination, org.apache.commons.compress.archivers.ArchiveInputStream stream, org.apache.commons.compress.archivers.ArchiveEntry entry) throws java.io.IOException
        private void LoadEntry(Path destination, ArchiveInputStream stream, ArchiveEntry entry)
        {
            Path file = destination.resolve(entry.Name);

            if (!file.normalize().StartsWith(destination))
            {
                throw new IOException("Zip entry outside destination path.");
            }

            if (entry.Directory)
            {
                Files.createDirectories(file);
            }
            else
            {
                using (Stream output = Files.newOutputStream(file))
                {
                    Utils.Copy(stream, output, _progressPrinter);
                }
            }
        }
Esempio n. 3
0
 /**
  * Adds a new archive entry to the archive.
  * If replace is set to true, this change will replace all other additions
  * done in this ChangeSet and all existing entries in the original stream.
  *
  * @param pEntry
  *            the entry to add
  * @param pInput
  *            the datastream to add
  * @param replace
  *            indicates the this change should replace existing entries
  */
 public void add(org.apache.commons.compress.archivers.ArchiveEntry pEntry, java.io.InputStream pInput, bool replace)
 {
     addAddition(new Change(pEntry, pInput, replace));
 }
Esempio n. 4
0
 /**
  * Adds a new archive entry to the archive.
  *
  * @param pEntry
  *            the entry to add
  * @param pInput
  *            the datastream to add
  */
 public void add(org.apache.commons.compress.archivers.ArchiveEntry pEntry, java.io.InputStream pInput)
 {
     this.add(pEntry, pInput, true);
 }
Esempio n. 5
0
        private static Path DetermineEntryDestination(ArchiveEntry entry, Path databaseDestination, Path transactionLogsDirectory)
        {
            string entryName = Paths.get(entry.Name).FileName.ToString();

            return(TransactionLogFiles.DEFAULT_FILENAME_FILTER.accept(null, entryName) ? transactionLogsDirectory : databaseDestination);
        }