Class ChangeSet<E extends ArchiveEntry>

  • Type Parameters:
    E - The ArchiveEntry type.

    public final class ChangeSet<E extends ArchiveEntry>
    extends java.lang.Object
    ChangeSet collects and performs changes to an archive. Putting delete changes in this ChangeSet from multiple threads can cause conflicts.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Set<Change<E>> changes  
    • Constructor Summary

      Constructors 
      Constructor Description
      ChangeSet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(E entry, java.io.InputStream input)
      Adds a new archive entry to the archive.
      void add​(E entry, java.io.InputStream input, boolean replace)
      Adds a new archive entry to the archive.
      private void addAddition​(Change<E> addChange)
      Adds an addition change.
      private void addDeletion​(Change<E> deleteChange)
      Adds an delete change.
      void delete​(java.lang.String fileName)
      Deletes the file with the file name from the archive.
      void deleteDir​(java.lang.String dirName)
      Deletes the directory tree from the archive.
      (package private) java.util.Set<Change<E>> getChanges()
      Gets the list of changes as a copy.
      • Methods inherited from class java.lang.Object

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

      • ChangeSet

        public ChangeSet()
    • Method Detail

      • add

        public void add​(E entry,
                        java.io.InputStream input)
        Adds a new archive entry to the archive.
        Parameters:
        entry - the entry to add
        input - the data stream to add
      • add

        public void add​(E entry,
                        java.io.InputStream input,
                        boolean replace)
        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.
        Parameters:
        entry - the entry to add
        input - the data stream to add
        replace - indicates the this change should replace existing entries
      • addAddition

        private void addAddition​(Change<E> addChange)
        Adds an addition change.
        Parameters:
        addChange - the change which should result in an addition
      • addDeletion

        private void addDeletion​(Change<E> deleteChange)
        Adds an delete change.
        Parameters:
        deleteChange - the change which should result in a deletion
      • delete

        public void delete​(java.lang.String fileName)
        Deletes the file with the file name from the archive.
        Parameters:
        fileName - the file name of the file to delete
      • deleteDir

        public void deleteDir​(java.lang.String dirName)
        Deletes the directory tree from the archive.
        Parameters:
        dirName - the name of the directory tree to delete
      • getChanges

        java.util.Set<Change<E>> getChanges()
        Gets the list of changes as a copy. Changes on this set are not reflected on this ChangeSet and vice versa.
        Returns:
        the changes as a copy