Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5240911668 for ; Sun, 31 Aug 2014 19:29:22 +0000 (UTC) Received: (qmail 79900 invoked by uid 500); 31 Aug 2014 19:29:22 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 79828 invoked by uid 500); 31 Aug 2014 19:29:22 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 79819 invoked by uid 99); 31 Aug 2014 19:29:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Aug 2014 19:29:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Aug 2014 19:28:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 758F02388BEC for ; Sun, 31 Aug 2014 19:28:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r920865 [14/45] - in /websites/production/commons/content/proper/commons-compress: ./ apidocs/ apidocs/org/apache/commons/compress/archivers/ apidocs/org/apache/commons/compress/archivers/ar/ apidocs/org/apache/commons/compress/archivers/ar... Date: Sun, 31 Aug 2014 19:27:54 -0000 To: commits@commons.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140831192819.758F02388BEC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: websites/production/commons/content/proper/commons-compress/apidocs/org/apache/commons/compress/utils/IOUtils.html ============================================================================== --- websites/production/commons/content/proper/commons-compress/apidocs/org/apache/commons/compress/utils/IOUtils.html (original) +++ websites/production/commons/content/proper/commons-compress/apidocs/org/apache/commons/compress/utils/IOUtils.html Sun Aug 31 19:27:46 2014 @@ -126,14 +126,14 @@ extends static long -copy(InputStream input, +copy(InputStream input, OutputStream output)
Copies the content of a InputStream into an OutputStream.
static long -copy(InputStream input, +copy(InputStream input, OutputStream output, int buffersize)
Copies the content of a InputStream into an OutputStream
@@ -141,14 +141,14 @@ extends static int -readFully(InputStream input, +readFully(InputStream input, byte[] b)
Reads as much from input as possible to fill the given array.
static int -readFully(InputStream input, +readFully(InputStream input, byte[] b, int offset, int len) @@ -158,7 +158,7 @@ extends static long -skip(InputStream input, +skip(InputStream input, long numToSkip)
Skips the given number of bytes by repeatedly invoking skip on the given input stream if necessary.
@@ -176,7 +176,7 @@ extends Object -clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait Modified: websites/production/commons/content/proper/commons-compress/apidocs/overview-tree.html ============================================================================== --- websites/production/commons/content/proper/commons-compress/apidocs/overview-tree.html (original) +++ websites/production/commons/content/proper/commons-compress/apidocs/overview-tree.html Sun Aug 31 19:27:46 2014 @@ -111,6 +111,7 @@
  • org.apache.commons.compress.changes.ChangeSetResults
  • org.apache.commons.compress.utils.CharsetNames
  • org.apache.commons.compress.utils.Charsets
  • +
  • org.apache.commons.compress.archivers.sevenz.CLI
  • org.apache.commons.compress.compressors.CompressorStreamFactory
  • org.apache.commons.compress.archivers.cpio.CpioArchiveEntry (implements org.apache.commons.compress.archivers.ArchiveEntry, org.apache.commons.compress.archivers.cpio.CpioConstants)
  • org.apache.commons.compress.compressors.deflate.DeflateParameters
  • Added: websites/production/commons/content/proper/commons-compress/apidocs/src-html/org/apache/commons/compress/archivers/sevenz/CLI.html ============================================================================== --- websites/production/commons/content/proper/commons-compress/apidocs/src-html/org/apache/commons/compress/archivers/sevenz/CLI.html (added) +++ websites/production/commons/content/proper/commons-compress/apidocs/src-html/org/apache/commons/compress/archivers/sevenz/CLI.html Sun Aug 31 19:27:46 2014 @@ -0,0 +1,222 @@ + + + +Source code + + + +
    +
    001/*
    +002 *  Licensed to the Apache Software Foundation (ASF) under one or more
    +003 *  contributor license agreements.  See the NOTICE file distributed with
    +004 *  this work for additional information regarding copyright ownership.
    +005 *  The ASF licenses this file to You under the Apache License, Version 2.0
    +006 *  (the "License"); you may not use this file except in compliance with
    +007 *  the License.  You may obtain a copy of the License at
    +008 *
    +009 *      http://www.apache.org/licenses/LICENSE-2.0
    +010 *
    +011 *  Unless required by applicable law or agreed to in writing, software
    +012 *  distributed under the License is distributed on an "AS IS" BASIS,
    +013 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +014 *  See the License for the specific language governing permissions and
    +015 *  limitations under the License.
    +016 *
    +017 */
    +018package org.apache.commons.compress.archivers.sevenz;
    +019
    +020import java.io.File;
    +021import java.io.FileOutputStream;
    +022import java.io.IOException;
    +023
    +024public class CLI {
    +025
    +026    private static final byte[] BUF = new byte[8192];
    +027
    +028    private static enum Mode {
    +029        LIST("Analysing") {
    +030            public void takeAction(SevenZFile archive, SevenZArchiveEntry entry) {
    +031                System.out.print(entry.getName());
    +032                if (entry.isDirectory()) {
    +033                    System.out.print(" dir");
    +034                } else {
    +035                    System.out.print(" " + entry.getCompressedSize()
    +036                                     + "/" + entry.getSize());
    +037                }
    +038                if (entry.getHasLastModifiedDate()) {
    +039                    System.out.print(" " + entry.getLastModifiedDate());
    +040                } else {
    +041                    System.out.print(" no last modified date");
    +042                }
    +043                if (!entry.isDirectory()) {
    +044                    System.out.println(" " + getContentMethods(entry));
    +045                } else {
    +046                    System.out.println("");
    +047                }
    +048            }
    +049
    +050            private String getContentMethods(SevenZArchiveEntry entry) {
    +051                StringBuilder sb = new StringBuilder();
    +052                boolean first = true;
    +053                for (SevenZMethodConfiguration m : entry.getContentMethods()) {
    +054                    if (!first) {
    +055                        sb.append(", ");
    +056                    }
    +057                    first = false;
    +058                    sb.append(m.getMethod());
    +059                    if (m.getOptions() != null) {
    +060                        sb.append("(" + m.getOptions() + ")");
    +061                    }
    +062                }
    +063                return sb.toString();
    +064            }
    +065        },
    +066        EXTRACT("Extracting") {
    +067            public void takeAction(SevenZFile archive, SevenZArchiveEntry entry) 
    +068                throws IOException {
    +069                File outFile = new File(entry.getName());
    +070                if (entry.isDirectory()) {
    +071                    if (!outFile.isDirectory() && !outFile.mkdirs()) {
    +072                        throw new IOException("Cannot create directory " + outFile);
    +073                    }
    +074                    System.out.println("created directory " + outFile);
    +075                    return;
    +076                }
    +077
    +078                System.out.println("extracting to " + outFile);
    +079                File parent = outFile.getParentFile();
    +080                if (parent != null && !parent.exists() && !parent.mkdirs()) {
    +081                    throw new IOException("Cannot create " + parent);
    +082                }
    +083                FileOutputStream fos = new FileOutputStream(outFile);
    +084                try {
    +085                    final long total = entry.getSize();
    +086                    long off = 0;
    +087                    while (off < total) {
    +088                        int toRead = (int) Math.min(total - off, BUF.length);
    +089                        int bytesRead = archive.read(BUF, 0, toRead);
    +090                        if (bytesRead < 1) {
    +091                            throw new IOException("reached end of entry "
    +092                                                  + entry.getName()
    +093                                                  + " after " + off
    +094                                                  + " bytes, expected "
    +095                                                  + total);
    +096                        }
    +097                        off += bytesRead;
    +098                        fos.write(BUF, 0, bytesRead);
    +099                    }
    +100                } finally {
    +101                    fos.close();
    +102                }
    +103            }
    +104        };
    +105
    +106        private final String message;
    +107        private Mode(String message) {
    +108            this.message = message;
    +109        }
    +110        public String getMessage() {
    +111            return message;
    +112        }
    +113        public abstract void takeAction(SevenZFile archive, SevenZArchiveEntry entry)
    +114            throws IOException;
    +115    }        
    +116
    +117    public static void main(String[] args) throws Exception {
    +118        if (args.length == 0) {
    +119            usage();
    +120            return;
    +121        }
    +122        Mode mode = grabMode(args);
    +123        System.out.println(mode.getMessage() + " " + args[0]);
    +124        File f = new File(args[0]);
    +125        if (!f.isFile()) {
    +126            System.err.println(f + " doesn't exist or is a directory");
    +127        }
    +128        SevenZFile archive = new SevenZFile(f);
    +129        try {
    +130            SevenZArchiveEntry ae;
    +131            while((ae=archive.getNextEntry()) != null) {
    +132                mode.takeAction(archive, ae);
    +133            }
    +134        } finally {
    +135            archive.close();
    +136        }
    +137    }
    +138
    +139    private static void usage() {
    +140        System.out.println("Parameters: archive-name [list|extract]");
    +141    }
    +142
    +143    private static Mode grabMode(String[] args) {
    +144        if (args.length < 2) {
    +145            return Mode.LIST;
    +146        }
    +147        return Enum.valueOf(Mode.class, args[1].toUpperCase());
    +148    }
    +149
    +150}
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + \ No newline at end of file Propchange: websites/production/commons/content/proper/commons-compress/apidocs/src-html/org/apache/commons/compress/archivers/sevenz/CLI.html ------------------------------------------------------------------------------ svn:eol-style = native Modified: websites/production/commons/content/proper/commons-compress/apidocs/src-html/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.html ============================================================================== --- websites/production/commons/content/proper/commons-compress/apidocs/src-html/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.html (original) +++ websites/production/commons/content/proper/commons-compress/apidocs/src-html/org/apache/commons/compress/archivers/sevenz/SevenZArchiveEntry.html Sun Aug 31 19:27:46 2014 @@ -124,7 +124,7 @@ 116 /** 117 * Sets whether this is an "anti-item" used in differential backups, 118 * meaning it should delete the same file from a previous backup. -119 * @param isAntiItem true if it is an ait-item, false otherwise +119 * @param isAntiItem true if it is an anti-item, false otherwise 120 */ 121 public void setAntiItem(boolean isAntiItem) { 122 this.isAntiItem = isAntiItem; @@ -422,7 +422,7 @@ 414 * 415 * <p>Currently only {@link SevenZMethod#COPY}, {@link 416 * SevenZMethod#LZMA2}, {@link SevenZMethod#BZIP2} and {@link -417 * SevenZMethod#DEFLATE} are supported.</p> +417 * SevenZMethod#DEFLATE} are supported when writing archives.</p> 418 * 419 * <p>The methods will be consulted in iteration order to create 420 * the final output.</p> @@ -447,7 +447,7 @@ 439 * 440 * <p>Currently only {@link SevenZMethod#COPY}, {@link 441 * SevenZMethod#LZMA2}, {@link SevenZMethod#BZIP2} and {@link -442 * SevenZMethod#DEFLATE} are supported.</p> +442 * SevenZMethod#DEFLATE} are supported when writing archives.</p> 443 * 444 * <p>The methods will be consulted in iteration order to create 445 * the final output.</p>