Index: src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
===================================================================
--- src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java	(revision 1601611)
+++ src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java	(working copy)
@@ -24,6 +24,8 @@
 
 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
+import org.apache.commons.compress.compressors.deflate.DeflateCompressorInputStream;
+import org.apache.commons.compress.compressors.deflate.DeflateCompressorOutputStream;
 import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
 import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
 import org.apache.commons.compress.compressors.lzma.LZMACompressorInputStream;
@@ -112,6 +114,12 @@
      */
     public static final String Z = "z";
 
+    /**
+     * Constant used to identify the Deflate compress method.
+     * @since 1.9
+     */
+    public static final String DEFLATE = "deflate";
+
     private boolean decompressConcatenated = false;
 
     /**
@@ -241,6 +249,10 @@
                 return new ZCompressorInputStream(in);
             }
 
+            if (DEFLATE.equalsIgnoreCase(name)) {
+                return new DeflateCompressorInputStream(in);
+            }
+
         } catch (IOException e) {
             throw new CompressorException(
                     "Could not create CompressorInputStream.", e);
@@ -283,6 +295,10 @@
                 return new Pack200CompressorOutputStream(out);
             }
 
+            if (DEFLATE.equalsIgnoreCase(name)) {
+                return new DeflateCompressorOutputStream(out);
+            }
+
         } catch (IOException e) {
             throw new CompressorException(
                     "Could not create CompressorOutputStream", e);
Index: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
===================================================================
--- src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java	(revision 0)
+++ src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java	(working copy)
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.deflate;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+import org.apache.commons.compress.compressors.CompressorInputStream;
+
+/**
+ * Deflate decompressor.
+ * @since 1.9
+ */
+public class DeflateCompressorInputStream extends CompressorInputStream {
+    private final InputStream in;
+
+    /**
+     * Creates a new input stream that decompresses Deflate-compressed data
+     * from the specified input stream.
+     *
+     * @param       inputStream where to read the compressed data
+     *
+     */
+    public DeflateCompressorInputStream(InputStream inputStream) {
+        this(inputStream, new DeflateParameters());
+    }
+
+    /**
+     * Creates a new input stream that decompresses Deflate-compressed data
+     * from the specified input stream.
+     *
+     * @param       inputStream where to read the compressed data
+     * @param       compressor parameters
+     */
+    public DeflateCompressorInputStream(InputStream inputStream,
+                                        DeflateParameters parameters) {
+        in = new InflaterInputStream(inputStream, new Inflater(!parameters.isZlibHeaderPresent()));
+    }
+    
+    /** {@inheritDoc} */
+    @Override
+    public int read() throws IOException {
+        int ret = in.read();
+        count(ret == -1 ? 0 : 1);
+        return ret;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int read(byte[] buf, int off, int len) throws IOException {
+        int ret = in.read(buf, off, len);
+        count(ret);
+        return ret;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public long skip(long n) throws IOException {
+        return in.skip(n);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int available() throws IOException {
+        return in.available();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void close() throws IOException {
+        in.close();
+    }
+}

Property changes on: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
===================================================================
--- src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java	(revision 0)
+++ src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java	(working copy)
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.deflate;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+
+/**
+ * Deflate compressor.
+ * @since 1.9
+ */
+public class DeflateCompressorOutputStream extends CompressorOutputStream {
+    private final DeflaterOutputStream out;
+   
+    /**
+     * Creates a Deflate compressed output stream with the default parameters.
+     */
+    public DeflateCompressorOutputStream(OutputStream outputStream) throws IOException {
+        this(outputStream, new DeflateParameters());
+    }
+
+    /**
+     * Creates a Deflate compressed output stream with the specified parameters.
+     */
+    public DeflateCompressorOutputStream(OutputStream outputStream,
+                                         DeflateParameters parameters) throws IOException {
+        this.out = new DeflaterOutputStream(outputStream, new Deflater(parameters.getCompressionLevel(), !parameters.isZlibHeaderPresent()));
+    }
+
+    @Override
+    public void write(int b) throws IOException {
+        out.write(b);
+    }
+
+    @Override
+    public void write(byte[] buf, int off, int len) throws IOException {
+        out.write(buf, off, len);
+    }
+
+    /**
+     * Flushes the encoder and calls <code>outputStream.flush()</code>.
+     * All buffered pending data will then be decompressible from
+     * the output stream. Calling this function very often may increase
+     * the compressed file size a lot.
+     */
+    @Override
+    public void flush() throws IOException {
+        out.flush();
+    }
+
+    /**
+     * Finishes compression without closing the underlying stream.
+     * No more data can be written to this stream after finishing.
+     */
+    public void finish() throws IOException {
+        out.finish();
+    }
+
+    @Override
+    public void close() throws IOException {
+        out.close();
+    }
+}

Property changes on: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
===================================================================
--- src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java	(revision 0)
+++ src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java	(working copy)
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.compress.compressors.deflate;
+
+import java.util.zip.Deflater;
+
+/**
+ * Parameters for the Deflate compressor.
+ * @since 1.9
+ */
+public class DeflateParameters {
+
+    private boolean zlibHeaderPresent = true;
+    private int compressionLevel = Deflater.DEFAULT_COMPRESSION;
+
+    public boolean isZlibHeaderPresent() {
+        return zlibHeaderPresent;
+    }
+
+    /**
+     * Sets the zlib header presence parameter.
+     * This affects whether or not the zlib header will be written (when compressing) or expected (when decompressing).
+     *
+     * @param zlibHeaderPresent
+     */
+    public void setZlibHeaderPresent(boolean zlibHeaderPresent) {
+        this.zlibHeaderPresent = zlibHeaderPresent;
+    }
+
+    public int getCompressionLevel() {
+        return compressionLevel;
+    }
+
+    /**
+     * Sets the compression level.
+     *
+     * @param compressionLevel the compression level (between 0 and 9)
+     * @see Deflater#NO_COMPRESSION
+     * @see Deflater#BEST_SPEED
+     * @see Deflater#DEFAULT_COMPRESSION
+     * @see Deflater#BEST_COMPRESSION
+     */
+    public void setCompressionLevel(int compressionLevel) {
+        if (compressionLevel < -1 || compressionLevel > 9) {
+            throw new IllegalArgumentException("Invalid Deflate compression level: " + compressionLevel);
+        }
+        this.compressionLevel = compressionLevel;
+    }
+
+}

Property changes on: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
===================================================================
--- src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java	(revision 0)
+++ src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java	(working copy)
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.deflate;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+import org.apache.commons.compress.compressors.CompressorInputStream;
+
+/**
+ * Deflate decompressor.
+ * @since 1.9
+ */
+public class DeflateCompressorInputStream extends CompressorInputStream {
+    private final InputStream in;
+
+    /**
+     * Creates a new input stream that decompresses Deflate-compressed data
+     * from the specified input stream.
+     *
+     * @param       inputStream where to read the compressed data
+     *
+     */
+    public DeflateCompressorInputStream(InputStream inputStream) {
+        this(inputStream, new DeflateParameters());
+    }
+
+    /**
+     * Creates a new input stream that decompresses Deflate-compressed data
+     * from the specified input stream.
+     *
+     * @param       inputStream where to read the compressed data
+     * @param       compressor parameters
+     */
+    public DeflateCompressorInputStream(InputStream inputStream,
+                                        DeflateParameters parameters) {
+        in = new InflaterInputStream(inputStream, new Inflater(!parameters.isZlibHeaderPresent()));
+    }
+    
+    /** {@inheritDoc} */
+    @Override
+    public int read() throws IOException {
+        int ret = in.read();
+        count(ret == -1 ? 0 : 1);
+        return ret;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int read(byte[] buf, int off, int len) throws IOException {
+        int ret = in.read(buf, off, len);
+        count(ret);
+        return ret;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public long skip(long n) throws IOException {
+        return in.skip(n);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int available() throws IOException {
+        return in.available();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void close() throws IOException {
+        in.close();
+    }
+}

Property changes on: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
===================================================================
--- src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java	(revision 0)
+++ src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java	(working copy)
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.deflate;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+
+/**
+ * Deflate compressor.
+ * @since 1.9
+ */
+public class DeflateCompressorOutputStream extends CompressorOutputStream {
+    private final DeflaterOutputStream out;
+   
+    /**
+     * Creates a Deflate compressed output stream with the default parameters.
+     */
+    public DeflateCompressorOutputStream(OutputStream outputStream) throws IOException {
+        this(outputStream, new DeflateParameters());
+    }
+
+    /**
+     * Creates a Deflate compressed output stream with the specified parameters.
+     */
+    public DeflateCompressorOutputStream(OutputStream outputStream,
+                                         DeflateParameters parameters) throws IOException {
+        this.out = new DeflaterOutputStream(outputStream, new Deflater(parameters.getCompressionLevel(), !parameters.isZlibHeaderPresent()));
+    }
+
+    @Override
+    public void write(int b) throws IOException {
+        out.write(b);
+    }
+
+    @Override
+    public void write(byte[] buf, int off, int len) throws IOException {
+        out.write(buf, off, len);
+    }
+
+    /**
+     * Flushes the encoder and calls <code>outputStream.flush()</code>.
+     * All buffered pending data will then be decompressible from
+     * the output stream. Calling this function very often may increase
+     * the compressed file size a lot.
+     */
+    @Override
+    public void flush() throws IOException {
+        out.flush();
+    }
+
+    /**
+     * Finishes compression without closing the underlying stream.
+     * No more data can be written to this stream after finishing.
+     */
+    public void finish() throws IOException {
+        out.finish();
+    }
+
+    @Override
+    public void close() throws IOException {
+        out.close();
+    }
+}

Property changes on: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
===================================================================
--- src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java	(revision 0)
+++ src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java	(working copy)
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.compress.compressors.deflate;
+
+import java.util.zip.Deflater;
+
+/**
+ * Parameters for the Deflate compressor.
+ * @since 1.9
+ */
+public class DeflateParameters {
+
+    private boolean zlibHeaderPresent = true;
+    private int compressionLevel = Deflater.DEFAULT_COMPRESSION;
+
+    public boolean isZlibHeaderPresent() {
+        return zlibHeaderPresent;
+    }
+
+    /**
+     * Sets the zlib header presence parameter.
+     * This affects whether or not the zlib header will be written (when compressing) or expected (when decompressing).
+     *
+     * @param zlibHeaderPresent
+     */
+    public void setZlibHeaderPresent(boolean zlibHeaderPresent) {
+        this.zlibHeaderPresent = zlibHeaderPresent;
+    }
+
+    public int getCompressionLevel() {
+        return compressionLevel;
+    }
+
+    /**
+     * Sets the compression level.
+     *
+     * @param compressionLevel the compression level (between 0 and 9)
+     * @see Deflater#NO_COMPRESSION
+     * @see Deflater#BEST_SPEED
+     * @see Deflater#DEFAULT_COMPRESSION
+     * @see Deflater#BEST_COMPRESSION
+     */
+    public void setCompressionLevel(int compressionLevel) {
+        if (compressionLevel < -1 || compressionLevel > 9) {
+            throw new IllegalArgumentException("Invalid Deflate compression level: " + compressionLevel);
+        }
+        this.compressionLevel = compressionLevel;
+    }
+
+}

Property changes on: src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java
===================================================================
--- src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java	(revision 0)
+++ src/test/java/org/apache/commons/compress/compressors/DeflateTestCase.java	(working copy)
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.commons.compress.AbstractTestCase;
+import org.apache.commons.compress.utils.IOUtils;
+
+public final class DeflateTestCase extends AbstractTestCase {
+
+    public void testDeflateCreation()  throws Exception {
+        final File input = getFile("test1.xml");
+        final File output = new File(dir, "test1.xml.deflate");
+        final OutputStream out = new FileOutputStream(output);
+        try {
+            final CompressorOutputStream cos = new CompressorStreamFactory()
+                .createCompressorOutputStream("deflate", out);
+            try {
+                IOUtils.copy(new FileInputStream(input), cos);
+            } finally {
+                cos.close();
+            }
+        } finally {
+            out.close();
+        }
+    }
+
+    public void testDeflateUnarchive() throws Exception {
+        final File input = getFile("bla.tar.deflate");
+        final File output = new File(dir, "bla.tar");
+        final InputStream is = new FileInputStream(input);
+        try {
+            final CompressorInputStream in = new CompressorStreamFactory()
+                .createCompressorInputStream("deflate", is);
+            FileOutputStream out = null;
+            try {
+                out = new FileOutputStream(output);
+                IOUtils.copy(in, out);
+            } finally {
+                if (out != null) {
+                    out.close();
+                }
+                in.close();
+            }
+        } finally {
+            is.close();
+        }
+    }
+}
Index: src/test/resources/bla.tar.deflate
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: src/test/resources/bla.tar.deflate
===================================================================
--- src/test/resources/bla.tar.deflate	(revision 0)
+++ src/test/resources/bla.tar.deflate	(working copy)

Property changes on: src/test/resources/bla.tar.deflate
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
