commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r670243 - in /commons/sandbox/compress/trunk/src: java/org/apache/commons/compress/archivers/tar/TarOutputStream.java test/org/apache/commons/compress/archivers/tar/TarTestCase.java
Date Sat, 21 Jun 2008 17:55:46 GMT
Author: ebourg
Date: Sat Jun 21 10:55:46 2008
New Revision: 670243

URL: http://svn.apache.org/viewvc?rev=670243&view=rev
Log:
Fixed TarOutputStream for files bigger than 2GB

Modified:
    commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
    commons/sandbox/compress/trunk/src/test/org/apache/commons/compress/archivers/tar/TarTestCase.java

Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java?rev=670243&r1=670242&r2=670243&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
Sat Jun 21 10:55:46 2008
@@ -62,8 +62,8 @@
     private byte[] m_assemBuf;
     private int m_assemLen;
     private TarBuffer m_buffer;
-    private int m_currBytes;
-    private int m_currSize;
+    private long m_currBytes;
+    private long m_currSize;
 
     private byte[] m_oneBuf;
     private byte[] m_recordBuf;
@@ -262,7 +262,7 @@
         }
         else
         {
-            m_currSize = (int)entry.getSize();
+            m_currSize = entry.getSize();
         }
     }
 

Modified: commons/sandbox/compress/trunk/src/test/org/apache/commons/compress/archivers/tar/TarTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/org/apache/commons/compress/archivers/tar/TarTestCase.java?rev=670243&r1=670242&r2=670243&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/test/org/apache/commons/compress/archivers/tar/TarTestCase.java
(original)
+++ commons/sandbox/compress/trunk/src/test/org/apache/commons/compress/archivers/tar/TarTestCase.java
Sat Jun 21 10:55:46 2008
@@ -27,6 +27,8 @@
 import java.io.InputStream;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.input.NullInputStream;
+import org.apache.commons.io.output.NullOutputStream;
 
 import junit.framework.TestCase;
 
@@ -126,6 +128,19 @@
         temp.delete();
     }
 
+    public void testArchive8GbFile() throws Exception
+    {
+        long size = (long) 8 * 1024 * 1024 * 1024;
+
+        TarOutputStream out = new TarOutputStream(new NullOutputStream());
+        TarEntry entry = new TarEntry("bigfile.data");
+        entry.setSize(size);
+
+        out.putNextEntry(entry);
+        out.copyEntryContents( new NullInputStream(size) );
+        out.closeEntry();
+    }
+
     private void setupEntry( final TarEntry entry )
     {
         entry.setModTime( MOD_TIME );



Mime
View raw message