commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1559476 - in /commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers: ArchiveFormat.java spi/AbstractArchiveFormat.java
Date Sun, 19 Jan 2014 06:30:31 GMT
Author: bodewig
Date: Sun Jan 19 06:30:31 2014
New Revision: 1559476

URL: http://svn.apache.org/r1559476
Log:
ArchiveInput/Output is parameterized, so must be ArchiveFormat

Modified:
    commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/ArchiveFormat.java
    commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/spi/AbstractArchiveFormat.java

Modified: commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/ArchiveFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/ArchiveFormat.java?rev=1559476&r1=1559475&r2=1559476&view=diff
==============================================================================
--- commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/ArchiveFormat.java
(original)
+++ commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/ArchiveFormat.java
Sun Jan 19 06:30:31 2014
@@ -28,7 +28,7 @@ import java.io.IOException;
  * Describes a given archive format and works as factory and content-probe at the same time.
  * @Immutable
  */
-public interface ArchiveFormat {
+public interface ArchiveFormat<A extends ArchiveEntry> {
     /**
      * The name by which this format is known.
      * @return the name by which this format is known
@@ -91,7 +91,7 @@ public interface ArchiveFormat {
      * @throws IOException
      * @throws UnsupportedOperationException if this format cannot read from non-seekable
channels.
      */
-    ArchiveInput readFrom(Channel channel, Charset charset) throws IOException, UnsupportedOperationException;
+    ArchiveInput<A> readFrom(Channel channel, Charset charset) throws IOException,
UnsupportedOperationException;
     /**
      * Reads an archive assuming the given charset for entry names.
      * @param file the file to read from
@@ -100,7 +100,7 @@ public interface ArchiveFormat {
      */
     // TODO go for SeekableByteChannel rather than File when embracing Java7?
     // TODO use Path rather than File?
-    ArchiveInput readFrom(File file, Charset charset) throws IOException;
+    ArchiveInput<A> readFrom(File file, Charset charset) throws IOException;
     /**
      * Provides random access to an archive assuming the given charset for entry names.
      * @param file the file to read from
@@ -110,7 +110,7 @@ public interface ArchiveFormat {
      */
     // TODO go for SeekableByteChannel rather than File when embracing Java7?
     // TODO use Path rather than File?
-    RandomAccessArchiveInput readWithRandomAccessFrom(File file, Charset charset)
+    RandomAccessArchiveInput<A> readWithRandomAccessFrom(File file, Charset charset)
         throws IOException, UnsupportedOperationException;
 
     /**
@@ -121,7 +121,7 @@ public interface ArchiveFormat {
      * @throws UnsupportedOperationException if this format cannot write to non-seekable
channels or doesn't support
      * writing at all.
      */
-    ArchiveOutput writeTo(Channel channel, Charset charset) throws IOException, UnsupportedOperationException;
+    ArchiveOutput<A> writeTo(Channel channel, Charset charset) throws IOException,
UnsupportedOperationException;
     /**
      * Writes an archive using the given charset for entry names.
      * @param file the file to write to
@@ -131,5 +131,5 @@ public interface ArchiveFormat {
      */
     // TODO go for SeekableByteChannel rather than File when embracing Java7?
     // TODO use Path rather than File?
-    ArchiveOutput writeTo(File file, Charset charset) throws IOException, UnsupportedOperationException;
+    ArchiveOutput<A> writeTo(File file, Charset charset) throws IOException, UnsupportedOperationException;
 }

Modified: commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/spi/AbstractArchiveFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/spi/AbstractArchiveFormat.java?rev=1559476&r1=1559475&r2=1559476&view=diff
==============================================================================
--- commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/spi/AbstractArchiveFormat.java
(original)
+++ commons/proper/compress/branches/compress-2.0/src/main/java/org/apache/commons/compress2/archivers/spi/AbstractArchiveFormat.java
Sun Jan 19 06:30:31 2014
@@ -27,6 +27,7 @@ import java.nio.channels.Channel;
 //import java.nio.channels.FileChannel;
 import java.nio.charset.Charset;
 import java.util.Collections;
+import org.apache.commons.compress2.archivers.ArchiveEntry;
 import org.apache.commons.compress2.archivers.ArchiveFormat;
 import org.apache.commons.compress2.archivers.ArchiveInput;
 import org.apache.commons.compress2.archivers.ArchiveOutput;
@@ -36,7 +37,7 @@ import org.apache.commons.compress2.arch
  * Base class implementations may use.
  * @Immutable
  */
-public abstract class AbstractArchiveFormat implements ArchiveFormat {
+public abstract class AbstractArchiveFormat<A extends ArchiveEntry> implements ArchiveFormat<A>
{
 
     /**
      * {@inheritDoc}
@@ -99,7 +100,7 @@ public abstract class AbstractArchiveFor
      * <p>This implementation always throws an UnsupportedOperationException.</p>
      */
     @Override
-    public ArchiveInput readFrom(Channel channel, Charset charset) throws IOException, UnsupportedOperationException
{
+    public ArchiveInput<A> readFrom(Channel channel, Charset charset) throws IOException,
UnsupportedOperationException {
         throw new UnsupportedOperationException("this format cannot read from non-seekable
channels");
     }
     /**
@@ -108,7 +109,7 @@ public abstract class AbstractArchiveFor
      * #readFrom(File, Charset)} otherwise.</p>
      */
     @Override
-    public ArchiveInput readFrom(File file, Charset charset) throws IOException {
+    public ArchiveInput<A> readFrom(File file, Charset charset) throws IOException
{
         if (supportsRandomAccessInput()) {
             return readWithRandomAccessFrom(file, charset);
         }
@@ -121,7 +122,7 @@ public abstract class AbstractArchiveFor
      * <p>This implementation always throws an UnsupportedOperationException.</p>
      */
     @Override
-    public RandomAccessArchiveInput readWithRandomAccessFrom(File file, Charset charset)
+    public RandomAccessArchiveInput<A> readWithRandomAccessFrom(File file, Charset
charset)
         throws IOException, UnsupportedOperationException {
         throw new UnsupportedOperationException("this format cannot doesn't support random
access");
     }
@@ -131,7 +132,7 @@ public abstract class AbstractArchiveFor
      * <p>This implementation always throws an UnsupportedOperationException.</p>
      */
     @Override
-    public ArchiveOutput writeTo(Channel channel, Charset charset) throws IOException, UnsupportedOperationException
{
+    public ArchiveOutput<A> writeTo(Channel channel, Charset charset) throws IOException,
UnsupportedOperationException {
         throw new UnsupportedOperationException("this format is read-only");
     }
     /**
@@ -139,7 +140,7 @@ public abstract class AbstractArchiveFor
      * <p>This implementation always delegates to {@link #writeTo(Channel, Charset)}.</p>
      */
     @Override
-    public ArchiveOutput writeTo(File file, Charset charset) throws IOException, UnsupportedOperationException
{
+    public ArchiveOutput<A> writeTo(File file, Charset charset) throws IOException,
UnsupportedOperationException {
         // TODO use FileChannel.open in Java7
         return writeTo(new FileOutputStream(file).getChannel(), charset);
     }



Mime
View raw message