commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1590412 - in /commons/proper/compress/branches/compress-2.0: pom.xml src/main/java/org/apache/commons/compress2/archivers/spi/AbstractArchiveFormat.java
Date Sun, 27 Apr 2014 16:10:08 GMT
Author: bodewig
Date: Sun Apr 27 16:10:08 2014
New Revision: 1590412

URL: http://svn.apache.org/r1590412
Log:
Compress2 will require Java7

Modified:
    commons/proper/compress/branches/compress-2.0/pom.xml
    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/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/compress-2.0/pom.xml?rev=1590412&r1=1590411&r2=1590412&view=diff
==============================================================================
--- commons/proper/compress/branches/compress-2.0/pom.xml (original)
+++ commons/proper/compress/branches/compress-2.0/pom.xml Sun Apr 27 16:10:08 2014
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-parent</artifactId>
-    <version>32</version>
+    <version>34</version>
   </parent>
 
   <groupId>org.apache.commons</groupId>
@@ -35,8 +35,8 @@ These include: bzip2, gzip, pack200, lzm
   </description>
 
   <properties>
-    <maven.compiler.source>1.5</maven.compiler.source>
-    <maven.compiler.target>1.5</maven.compiler.target>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
     <commons.componentid>compress</commons.componentid>
     <commons.jira.id>COMPRESS</commons.jira.id>
     <commons.jira.pid>12310904</commons.jira.pid>

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=1590412&r1=1590411&r2=1590412&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 Apr 27 16:10:08 2014
@@ -19,14 +19,13 @@
 package org.apache.commons.compress2.archivers.spi;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.channels.WritableByteChannel;
-//import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel;
 import java.nio.charset.Charset;
+import java.nio.file.StandardOpenOption;
 import org.apache.commons.compress2.archivers.ArchiveEntry;
 import org.apache.commons.compress2.archivers.ArchiveFormat;
 import org.apache.commons.compress2.archivers.ArchiveInput;
@@ -107,8 +106,7 @@ public abstract class AbstractArchiveFor
             return readWithRandomAccessFrom(file, charset);
         }
 
-        // TODO use FileChannel.open in Java7
-        return readFrom(new FileInputStream(file).getChannel(), charset);
+        return readFrom(FileChannel.open(file.toPath(), StandardOpenOption.READ), charset);
     }
     /**
      * {@inheritDoc}
@@ -135,7 +133,8 @@ public abstract class AbstractArchiveFor
      */
     @Override
     public ArchiveOutput<A> writeTo(File file, Charset charset) throws IOException,
UnsupportedOperationException {
-        // TODO use FileChannel.open in Java7
-        return writeTo(new FileOutputStream(file).getChannel(), charset);
+        return writeTo(FileChannel.open(file.toPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE,
+                                        StandardOpenOption.TRUNCATE_EXISTING),
+                       charset);
     }
 }



Mime
View raw message