[ 
https://issues.apache.org/jira/browse/COMPRESS-384?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15979943#comment-15979943
 ] 

Stefan Bodewig commented on COMPRESS-384:
-----------------------------------------

Sorry for the delay, Jason.

I'm not sure I understand what you are doing. If I use 
{{org.apache.commons.compress.archivers.Lister}} I see the expected behaviour 
({{getNextEntry}} returns {{null}}) but we don't really try to read the entries 
themselves.

Hmm after applying 

{code}
diff --git a/src/main/java/org/apache/commons/compress/archivers/Lister.java 
b/src/main/java/org/apache/commons/compress/archivers/Lister.java
index 7df9591..232b2ed 100644
--- a/src/main/java/org/apache/commons/compress/archivers/Lister.java
+++ b/src/main/java/org/apache/commons/compress/archivers/Lister.java
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.io.InputStream;
 import java.nio.file.Files;
+import org.apache.commons.compress.utils.IOUtils;
 
 /**
  * Simple command line application that lists the contents of an archive.
@@ -49,7 +50,12 @@ public static void main(final String[] args) throws 
Exception {
             System.out.println("Created " + ais.toString());
             ArchiveEntry ae;
             while ((ae = ais.getNextEntry()) != null) {
-                System.out.println(ae.getName());
+                System.out.print(ae.getName());
+                if (ae.isDirectory()) {
+                    System.out.println(" is a directory");
+                } else {
+                    System.out.println(" has size " + 
IOUtils.toByteArray(ais).length);
+                }
             }
         }
     }
{code}

I seem to get reasonable sizes. Can you show a few lines of code where we can 
see what you are trying to do and where things go wrong?

> Tar File EOF not being detected
> -------------------------------
>
>                 Key: COMPRESS-384
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-384
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Build
>    Affects Versions: 1.13
>         Environment: Windows 10, JDK 1.8
>            Reporter: Jason Shattu
>         Attachments: file.tar
>
>
> I've created both a zip and tar file, with the same contents using the latest 
> version of 7zip. When I read both archives using code of the form:
> ArchiveStreamFactory().createArchiveInputStream(format, inputStream);
> I notice that both formats correctly list their contents, however the Tar 
> Input doesn't return a "null" entry when it hits the EOF from 
> archiveStream.getNextEntry() 
> this makes it hard to distinguish between a genuine EOF or a file which is 
> still being written to. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to