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 1E1C37969 for ; Wed, 14 Sep 2011 10:33:32 +0000 (UTC) Received: (qmail 74006 invoked by uid 500); 14 Sep 2011 10:33:31 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 73906 invoked by uid 500); 14 Sep 2011 10:33:31 -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 73899 invoked by uid 99); 14 Sep 2011 10:33:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Sep 2011 10:33:31 +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; Wed, 14 Sep 2011 10:33:27 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4C5522388A5F for ; Wed, 14 Sep 2011 10:33:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1170518 - in /commons/proper/compress/trunk/src: main/java/org/apache/commons/compress/compressors/pack200/ test/java/org/apache/commons/compress/compressors/ Date: Wed, 14 Sep 2011 10:33:04 -0000 To: commits@commons.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110914103305.4C5522388A5F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Wed Sep 14 10:33:04 2011 New Revision: 1170518 URL: http://svn.apache.org/viewvc?rev=1170518&view=rev Log: change some class names in the pack200 package. COMPRESS-142 Added: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryCachingStreamBridge.java - copied, changed from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryStreamSwitcher.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java - copied, changed from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamMode.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java - copied, changed from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamSwitcher.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileCachingStreamBridge.java - copied, changed from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileStreamSwitcher.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryStreamSwitcher.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamMode.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamSwitcher.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileStreamSwitcher.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/package.html commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java Copied: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryCachingStreamBridge.java (from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryStreamSwitcher.java) URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryCachingStreamBridge.java?p2=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryCachingStreamBridge.java&p1=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryStreamSwitcher.java&r1=1170505&r2=1170518&rev=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryStreamSwitcher.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/InMemoryCachingStreamBridge.java Wed Sep 14 10:33:04 2011 @@ -29,8 +29,8 @@ import java.io.InputStream; * memory. * @since Apache Commons Compress 1.3 */ -class InMemoryStreamSwitcher extends StreamSwitcher { - InMemoryStreamSwitcher() { +class InMemoryCachingStreamBridge extends StreamBridge { + InMemoryCachingStreamBridge() { super(new ByteArrayOutputStream()); } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java?rev=1170518&r1=1170517&r2=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStream.java Wed Sep 14 10:33:04 2011 @@ -38,7 +38,7 @@ import org.apache.commons.compress.compr */ public class Pack200CompressorInputStream extends CompressorInputStream { private final InputStream originalInput; - private final StreamSwitcher streamSwitcher; + private final StreamBridge streamBridge; /** * Decompresses the given stream, caching the decompressed data in @@ -49,7 +49,7 @@ public class Pack200CompressorInputStrea */ public Pack200CompressorInputStream(final InputStream in) throws IOException { - this(in, StreamMode.IN_MEMORY); + this(in, Pack200Strategy.IN_MEMORY); } /** @@ -60,7 +60,7 @@ public class Pack200CompressorInputStrea * provide better performance.

*/ public Pack200CompressorInputStream(final InputStream in, - final StreamMode mode) + final Pack200Strategy mode) throws IOException { this(in, null, mode, null); } @@ -75,7 +75,7 @@ public class Pack200CompressorInputStrea public Pack200CompressorInputStream(final InputStream in, final Map props) throws IOException { - this(in, StreamMode.IN_MEMORY, props); + this(in, Pack200Strategy.IN_MEMORY, props); } /** @@ -86,7 +86,7 @@ public class Pack200CompressorInputStrea * provide better performance.

*/ public Pack200CompressorInputStream(final InputStream in, - final StreamMode mode, + final Pack200Strategy mode, final Map props) throws IOException { this(in, null, mode, props); @@ -97,14 +97,14 @@ public class Pack200CompressorInputStrea * memory. */ public Pack200CompressorInputStream(final File f) throws IOException { - this(f, StreamMode.IN_MEMORY); + this(f, Pack200Strategy.IN_MEMORY); } /** * Decompresses the given file using the given strategy to cache * the results. */ - public Pack200CompressorInputStream(final File f, final StreamMode mode) + public Pack200CompressorInputStream(final File f, final Pack200Strategy mode) throws IOException { this(null, f, mode, null); } @@ -116,26 +116,26 @@ public class Pack200CompressorInputStrea public Pack200CompressorInputStream(final File f, final Map props) throws IOException { - this(f, StreamMode.IN_MEMORY, props); + this(f, Pack200Strategy.IN_MEMORY, props); } /** * Decompresses the given file using the given strategy to cache * the results and the given properties. */ - public Pack200CompressorInputStream(final File f, final StreamMode mode, + public Pack200CompressorInputStream(final File f, final Pack200Strategy mode, final Map props) throws IOException { this(null, f, mode, props); } private Pack200CompressorInputStream(final InputStream in, final File f, - final StreamMode mode, + final Pack200Strategy mode, final Map props) throws IOException { originalInput = in; - streamSwitcher = mode.newStreamSwitcher(); - JarOutputStream jarOut = new JarOutputStream(streamSwitcher); + streamBridge = mode.newStreamBridge(); + JarOutputStream jarOut = new JarOutputStream(streamBridge); Pack200.Unpacker u = Pack200.newUnpacker(); if (props != null) { u.properties().putAll(props); @@ -158,32 +158,32 @@ public class Pack200CompressorInputStrea /** {@inheritDoc} */ @Override public int read() throws IOException { - return streamSwitcher.getInput().read(); + return streamBridge.getInput().read(); } /** {@inheritDoc} */ @Override public int read(byte[] b) throws IOException { - return streamSwitcher.getInput().read(b); + return streamBridge.getInput().read(b); } /** {@inheritDoc} */ @Override public int read(byte[] b, int off, int count) throws IOException { - return streamSwitcher.getInput().read(b, off, count); + return streamBridge.getInput().read(b, off, count); } /** {@inheritDoc} */ @Override public int available() throws IOException { - return streamSwitcher.getInput().available(); + return streamBridge.getInput().available(); } /** {@inheritDoc} */ @Override public boolean markSupported() { try { - return streamSwitcher.getInput().markSupported(); + return streamBridge.getInput().markSupported(); } catch (IOException ex) { return false; } @@ -193,7 +193,7 @@ public class Pack200CompressorInputStrea @Override public void mark(int limit) { try { - streamSwitcher.getInput().mark(limit); + streamBridge.getInput().mark(limit); } catch (IOException ex) { throw new RuntimeException(ex); } @@ -202,19 +202,19 @@ public class Pack200CompressorInputStrea /** {@inheritDoc} */ @Override public void reset() throws IOException { - streamSwitcher.getInput().reset(); + streamBridge.getInput().reset(); } /** {@inheritDoc} */ @Override public long skip(long count) throws IOException { - return streamSwitcher.getInput().skip(count); + return streamBridge.getInput().skip(count); } @Override public void close() throws IOException { try { - streamSwitcher.stop(); + streamBridge.stop(); } finally { if (originalInput != null) { originalInput.close(); Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java?rev=1170518&r1=1170517&r2=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorOutputStream.java Wed Sep 14 10:33:04 2011 @@ -36,7 +36,7 @@ import org.apache.commons.compress.compr public class Pack200CompressorOutputStream extends CompressorOutputStream { private boolean finished = false; private final OutputStream originalOutput; - private final StreamSwitcher streamSwitcher; + private final StreamBridge streamBridge; private final Map properties; /** @@ -45,7 +45,7 @@ public class Pack200CompressorOutputStre */ public Pack200CompressorOutputStream(final OutputStream out) throws IOException { - this(out, StreamMode.IN_MEMORY); + this(out, Pack200Strategy.IN_MEMORY); } /** @@ -53,7 +53,7 @@ public class Pack200CompressorOutputStre * the results. */ public Pack200CompressorOutputStream(final OutputStream out, - final StreamMode mode) + final Pack200Strategy mode) throws IOException { this(out, mode, null); } @@ -65,7 +65,7 @@ public class Pack200CompressorOutputStre public Pack200CompressorOutputStream(final OutputStream out, final Map props) throws IOException { - this(out, StreamMode.IN_MEMORY, props); + this(out, Pack200Strategy.IN_MEMORY, props); } /** @@ -73,18 +73,18 @@ public class Pack200CompressorOutputStre * the results and the given properties. */ public Pack200CompressorOutputStream(final OutputStream out, - final StreamMode mode, + final Pack200Strategy mode, final Map props) throws IOException { originalOutput = out; - streamSwitcher = mode.newStreamSwitcher(); + streamBridge = mode.newStreamBridge(); properties = props; } /** {@inheritDoc} */ @Override public void write(int b) throws IOException { - streamSwitcher.write(b); + streamBridge.write(b); } /** @@ -92,7 +92,7 @@ public class Pack200CompressorOutputStre */ @Override public void write(byte[] b) throws IOException { - streamSwitcher.write(b); + streamBridge.write(b); } /** @@ -100,14 +100,14 @@ public class Pack200CompressorOutputStre */ @Override public void write(byte[] b, int from, int length) throws IOException { - streamSwitcher.write(b, from, length); + streamBridge.write(b, from, length); } @Override public void close() throws IOException { finish(); try { - streamSwitcher.stop(); + streamBridge.stop(); } finally { originalOutput.close(); } @@ -120,7 +120,7 @@ public class Pack200CompressorOutputStre if (properties != null) { p.properties().putAll(properties); } - p.pack(new JarInputStream(streamSwitcher.getInput()), + p.pack(new JarInputStream(streamBridge.getInput()), originalOutput); } } Copied: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java (from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamMode.java) URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java?p2=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java&p1=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamMode.java&r1=1170505&r2=1170518&rev=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamMode.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/Pack200Strategy.java Wed Sep 14 10:33:04 2011 @@ -26,19 +26,19 @@ import java.io.IOException; * output. * @since Apache Commons Compress 1.3 */ -public enum StreamMode { +public enum Pack200Strategy { /** Cache output in memory */ IN_MEMORY() { - StreamSwitcher newStreamSwitcher() { - return new InMemoryStreamSwitcher(); + StreamBridge newStreamBridge() { + return new InMemoryCachingStreamBridge(); } }, /** Cache output in a temporary file */ TEMP_FILE() { - StreamSwitcher newStreamSwitcher() throws IOException { - return new TempFileStreamSwitcher(); + StreamBridge newStreamBridge() throws IOException { + return new TempFileCachingStreamBridge(); } }; - abstract StreamSwitcher newStreamSwitcher() throws IOException; + abstract StreamBridge newStreamBridge() throws IOException; } \ No newline at end of file Copied: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java (from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamSwitcher.java) URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java?p2=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java&p1=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamSwitcher.java&r1=1170505&r2=1170518&rev=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamSwitcher.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/StreamBridge.java Wed Sep 14 10:33:04 2011 @@ -31,15 +31,15 @@ import java.io.OutputStream; * @ThreadSafe * @since Apache Commons Compress 1.3 */ -abstract class StreamSwitcher extends FilterOutputStream { +abstract class StreamBridge extends FilterOutputStream { private InputStream input; private final Object INPUT_LOCK = new Object(); - protected StreamSwitcher(OutputStream out) { + protected StreamBridge(OutputStream out) { super(out); } - protected StreamSwitcher() { + protected StreamBridge() { this(null); } Copied: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileCachingStreamBridge.java (from r1170505, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileStreamSwitcher.java) URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileCachingStreamBridge.java?p2=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileCachingStreamBridge.java&p1=commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileStreamSwitcher.java&r1=1170505&r2=1170518&rev=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileStreamSwitcher.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/TempFileCachingStreamBridge.java Wed Sep 14 10:33:04 2011 @@ -30,10 +30,10 @@ import java.io.InputStream; * a temporary file. * @since Apache Commons Compress 1.3 */ -class TempFileStreamSwitcher extends StreamSwitcher { +class TempFileCachingStreamBridge extends StreamBridge { private final File f; - TempFileStreamSwitcher() throws IOException { + TempFileCachingStreamBridge() throws IOException { f = File.createTempFile("commons-compress", "packtemp"); f.deleteOnExit(); out = new FileOutputStream(f); Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/package.html URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/package.html?rev=1170518&r1=1170517&r2=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/package.html (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/pack200/package.html Wed Sep 14 10:33:04 2011 @@ -66,7 +66,7 @@ pumping like Commons Exec's InputStreamPumper but they have all failed because they rely on the output end to be consumed completely or else the (un)pack will block - forever. Espectially for Pack200InputStream it is + forever. Especially for Pack200InputStream it is very likely that it will be wrapped in a ZipArchiveInputStream which will never read the archive completely as it is not interested in the ZIP central Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java?rev=1170518&r1=1170517&r2=1170518&view=diff ============================================================================== --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/Pack200TestCase.java Wed Sep 14 10:33:04 2011 @@ -34,28 +34,28 @@ import org.apache.commons.compress.archi import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.compressors.pack200.Pack200CompressorInputStream; import org.apache.commons.compress.compressors.pack200.Pack200CompressorOutputStream; -import org.apache.commons.compress.compressors.pack200.StreamMode; +import org.apache.commons.compress.compressors.pack200.Pack200Strategy; import org.apache.commons.compress.utils.IOUtils; public final class Pack200TestCase extends AbstractTestCase { public void testJarUnarchiveAllInMemory() throws Exception { - jarUnarchiveAll(false, StreamMode.IN_MEMORY); + jarUnarchiveAll(false, Pack200Strategy.IN_MEMORY); } public void testJarUnarchiveAllFileArgInMemory() throws Exception { - jarUnarchiveAll(true, StreamMode.IN_MEMORY); + jarUnarchiveAll(true, Pack200Strategy.IN_MEMORY); } public void testJarUnarchiveAllTempFile() throws Exception { - jarUnarchiveAll(false, StreamMode.TEMP_FILE); + jarUnarchiveAll(false, Pack200Strategy.TEMP_FILE); } public void testJarUnarchiveAllFileTempFile() throws Exception { - jarUnarchiveAll(true, StreamMode.TEMP_FILE); + jarUnarchiveAll(true, Pack200Strategy.TEMP_FILE); } - private void jarUnarchiveAll(boolean useFile, StreamMode mode) + private void jarUnarchiveAll(boolean useFile, Pack200Strategy mode) throws Exception { final File input = getFile("bla.pack"); final InputStream is = useFile @@ -88,14 +88,14 @@ public final class Pack200TestCase exten } public void testJarArchiveCreationInMemory() throws Exception { - jarArchiveCreation(StreamMode.IN_MEMORY); + jarArchiveCreation(Pack200Strategy.IN_MEMORY); } public void testJarArchiveCreationTempFile() throws Exception { - jarArchiveCreation(StreamMode.TEMP_FILE); + jarArchiveCreation(Pack200Strategy.TEMP_FILE); } - private void jarArchiveCreation(StreamMode mode) throws Exception { + private void jarArchiveCreation(Pack200Strategy mode) throws Exception { final File output = new File(dir, "bla.pack"); final File file1 = getFile("test1.xml");