move canRead/canWrite up.  Remove isSupportedCompressionMethod.  COMPRESS-93

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/compress/trunk@911795 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
index 5f0f805..41f708a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
@@ -96,6 +96,7 @@
      * Doesn't increment if the EOF has been hit (read == -1)
      * 
      * @param read the number of bytes read
+     * @since Apache Commons Compress 1.1
      */
     protected void count(long read) {
         if (read != -1) {
@@ -107,6 +108,7 @@
      * Decrements the counter of already read bytes.
      * 
      * @param read the number of bytes pushed back.
+     * @since Apache Commons Compress 1.1
      */
     protected void pushedBackBytes(long pushedBack) {
         bytesRead -= pushedBack;
@@ -125,8 +127,24 @@
     /**
      * Returns the current number of bytes read from this stream.
      * @return the number of read bytes
+     * @since Apache Commons Compress 1.1
      */
     public long getBytesRead() {
         return bytesRead;
     }
+
+    /**
+     * Whether this stream is able to read the given entry.
+     *
+     * <p>Some archive formats support variants or details that are
+     * not supported (yet).</p>
+     *
+     * <p>This implementation always returns true.
+     *
+     * @since Apache Commons Compress 1.1
+     */
+    public boolean canRead(ArchiveEntry ae) {
+        return true;
+    }
+
 }
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
index 7ba2fed..9e0da6f 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
@@ -127,6 +127,7 @@
      * Doesn't increment if the EOF has been hit (read == -1)
      * 
      * @param written the number of bytes written
+     * @since Apache Commons Compress 1.1
      */
     protected void count(long written) {
         if (written != -1) {
@@ -147,8 +148,22 @@
     /**
      * Returns the current number of bytes written to this stream.
      * @return the number of written bytes
+     * @since Apache Commons Compress 1.1
      */
     public long getBytesWritten() {
         return bytesWritten;
     }
+
+    /**
+     * Whether this stream is able to write the given entry.
+     *
+     * <p>Some archive formats support variants or details that are
+     * not supported (yet).</p>
+     *
+     * <p>This implementation always returns true.
+     * @since Apache Commons Compress 1.1
+     */
+    public boolean canWrite(ArchiveEntry ae) {
+        return true;
+    }
 }
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index 85d38d4..a5550f0 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -148,20 +148,6 @@
     }
 
     /**
-     * Checks whether the compression method of this entry is supported,
-     * i.e. whether the content of this entry can be accessed.
-     *
-     * @since Commons Compress 1.1
-     * @see <a href="https://issues.apache.org/jira/browse/COMPRESS-93"
-     *         >COMPRESS-93</a>
-     * @return <code>true</code> if the compression method is known
-     *         and supported, <code>false</code> otherwise
-     */
-    public boolean isSupportedCompressionMethod() {
-        return method == STORED || method == DEFLATED;
-    }
-
-    /**
      * Returns the compression method of this entry, or -1 if the
      * compression method has not been specified.
      *
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index a8e4318..71580ef 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -196,10 +196,14 @@
      * compression method that hasn't been implemented yet.</p>
      * @since Apache Commons Compress 1.1
      */
-    public boolean canRead(ZipArchiveEntry ze) {
-        return !ze.isEncrypted() &&
-            (ze.getMethod() == ZipArchiveEntry.STORED
-             || ze.getMethod() == ZipArchiveEntry.DEFLATED);
+    public boolean canRead(ArchiveEntry ae) {
+        if (ae instanceof ZipArchiveEntry) {
+            ZipArchiveEntry ze = (ZipArchiveEntry) ae;
+            return !ze.isEncrypted() &&
+                (ze.getMethod() == ZipArchiveEntry.STORED
+                 || ze.getMethod() == ZipArchiveEntry.DEFLATED);
+        }
+        return super.canRead(ae);
     }
 
     public int read(byte[] buffer, int start, int length) throws IOException {
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
index 97062c8..eb74346 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
@@ -511,9 +511,13 @@
      * compression method that hasn't been implemented yet.</p>
      * @since Apache Commons Compress 1.1
      */
-    public boolean canWrite(ZipArchiveEntry ze) {
-        return !ze.isEncrypted() &&
-            (ze.getMethod() == STORED || ze.getMethod() == DEFLATED);
+    public boolean canWrite(ArchiveEntry ae) {
+        if (ae instanceof ZipArchiveEntry) {
+            ZipArchiveEntry ze = (ZipArchiveEntry) ae;
+            return !ze.isEncrypted() &&
+                (ze.getMethod() == STORED || ze.getMethod() == DEFLATED);
+        }
+        return super.canWrite(ae);
     }
 
     /**