]> source.dussan.org Git - jgit.git/commitdiff
ArchiveCommand.Format: pass output stream as first argument to putEntry 00/13100/2
authorJonathan Nieder <jrn@google.com>
Thu, 23 May 2013 23:46:29 +0000 (16:46 -0700)
committerJonathan Nieder <jrn@google.com>
Fri, 24 May 2013 01:09:04 +0000 (18:09 -0700)
This is more consistent with other APIs where the output side is the
first parameter to be analagous to the left-hand side of an
assignment.

Change-Id: Iec46bd50bc973a38b77d8367296adf5474ba515f

org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/archive/ArchiveCommand.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/archive/TarFormat.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/archive/ZipFormat.java

index ff5b0d0cd3a9e8c5a4f02f83ed3e7a018a1cdb5d..ad1daebd42f7760d8bf95524123a573db65ae326 100644 (file)
@@ -106,7 +106,7 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
         *      ArchiveOutputStream out = format.createArchiveOutputStream(System.out);
         *      try {
         *              for (...) {
-        *                      format.putEntry(path, mode, repo.open(objectId), out);
+        *                      format.putEntry(out, path, mode, repo.open(objectId));
         *              }
         *      } finally {
         *              out.close();
@@ -114,9 +114,8 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
         */
        public static interface Format {
                ArchiveOutputStream createArchiveOutputStream(OutputStream s);
-               void putEntry(String path, FileMode mode, //
-                               ObjectLoader loader, ArchiveOutputStream out) //
-                               throws IOException;
+               void putEntry(ArchiveOutputStream out, String path, FileMode mode,
+                               ObjectLoader loader) throws IOException;
        }
 
        /**
@@ -204,7 +203,7 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
                                                continue;
 
                                        walk.getObjectId(idBuf, 0);
-                                       fmt.putEntry(name, mode, reader.open(idBuf), outa);
+                                       fmt.putEntry(outa, name, mode, reader.open(idBuf));
                                }
                        } finally {
                                outa.close();
index c27fb350b9261c610f0630b21496326253bc9fb1..a0bbd52403281415d6a5e4c52be0f9930ef64056 100644 (file)
@@ -57,8 +57,9 @@ class TarFormat implements ArchiveCommand.Format {
                return new TarArchiveOutputStream(s);
        }
 
-       public void putEntry(String path, FileMode mode, ObjectLoader loader,
-                               ArchiveOutputStream out) throws IOException {
+       public void putEntry(ArchiveOutputStream out,
+                       String path, FileMode mode, ObjectLoader loader)
+                       throws IOException {
                if (mode == FileMode.SYMLINK) {
                        final TarArchiveEntry entry = new TarArchiveEntry(
                                        path, TarConstants.LF_SYMLINK);
index d08428f54ad807749eee780920c2b85cf740b20c..a85ae3bfa823a5f7b51e84fa3a763356d4ba1adb 100644 (file)
@@ -56,8 +56,9 @@ class ZipFormat implements ArchiveCommand.Format {
                return new ZipArchiveOutputStream(s);
        }
 
-       public void putEntry(String path, FileMode mode, ObjectLoader loader,
-                               ArchiveOutputStream out) throws IOException {
+       public void putEntry(ArchiveOutputStream out,
+                       String path, FileMode mode, ObjectLoader loader)
+                       throws IOException {
                final ZipArchiveEntry entry = new ZipArchiveEntry(path);
 
                if (mode == FileMode.REGULAR_FILE) {