commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r762870 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes: Change.java ChangeSet.java
Date Tue, 07 Apr 2009 17:51:10 GMT
Author: grobmeier
Date: Tue Apr  7 17:51:09 2009
New Revision: 762870

URL: http://svn.apache.org/viewvc?rev=762870&view=rev
Log:
added some javadocs

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/Change.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/Change.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/Change.java?rev=762870&r1=762869&r2=762870&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/Change.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/Change.java
Tue Apr  7 17:51:09 2009
@@ -23,6 +23,8 @@
 import org.apache.commons.compress.archivers.ArchiveEntry;
 
 /**
+ * Change holds meta information about a change.
+ * 
  * @Immutable
  */
 class Change {

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java?rev=762870&r1=762869&r2=762870&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
Tue Apr  7 17:51:09 2009
@@ -29,18 +29,46 @@
 import org.apache.commons.compress.archivers.ArchiveOutputStream;
 import org.apache.commons.compress.utils.IOUtils;
 
+/**
+ * ChangeSet collects and performs changes to an archive.
+ */
 public final class ChangeSet {
 
     private final Set changes = new LinkedHashSet();
 
+    /**
+     * Deletes the file with the filename from the archive
+     * 
+     * @param pFilename
+     *            the filename of the file to delete
+     */
     public void delete(final String pFilename) {
         addDeletion(new Change(pFilename));
     }
 
+    /**
+     * Adds a new archive entry to the archive.
+     * 
+     * @param pEntry
+     *            the entry to add
+     * @param pInput
+     *            the datastream to add
+     */
     public void add(final ArchiveEntry pEntry, final InputStream pInput) {
         changes.add(new Change(pEntry, pInput));
     }
 
+    /**
+     * Performs all changes collected in this ChangeSet on the input stream and
+     * streams the result to the output stream.
+     * 
+     * @param in
+     *            the InputStream to perform the changes on
+     * @param out
+     *            the resulting OutputStream with all modifications
+     * @throws IOException
+     *             if an read/write error occursâ
+     */
     public void perform(ArchiveInputStream in, ArchiveOutputStream out)
             throws IOException {
         for (Iterator it = changes.iterator(); it.hasNext();) {
@@ -81,6 +109,12 @@
         }
     }
 
+    /**
+     * Adds an delete change
+     * 
+     * @param pChange
+     *            the change which should result in a deletion
+     */
     private void addDeletion(Change pChange) {
         if (Change.TYPE_DELETE != pChange.type()
                 || pChange.targetFile() == null) {
@@ -106,6 +140,15 @@
         changes.add(pChange);
     }
 
+    /**
+     * Checks if an ArchiveEntry is deleted later in the ChangeSet. This is
+     * necessary if an file is added with this ChangeSet, but later became
+     * deleted in the same set.
+     * 
+     * @param entry
+     *            the entry to check
+     * @return true, if this entry has an deletion change later, false otherwise
+     */
     private boolean isDeletedLater(ArchiveEntry entry) {
         String source = entry.getName();
 
@@ -126,6 +169,18 @@
         return false;
     }
 
+    /**
+     * Copies the ArchiveEntry to the Output stream
+     * 
+     * @param in
+     *            the stream to read the data from
+     * @param out
+     *            the stream to write the data to
+     * @param entry
+     *            the entry to write
+     * @throws IOException
+     *             if data cannot be read or written
+     */
     private static void copyStream(InputStream in, ArchiveOutputStream out,
             ArchiveEntry entry) throws IOException {
         out.putArchiveEntry(entry);



Mime
View raw message