commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Shattu (JIRA)" <>
Subject [jira] [Updated] (COMPRESS-384) Tar File EOF not being detected
Date Sat, 22 Apr 2017 17:32:04 GMT


Jason Shattu updated COMPRESS-384:

ok, I thought you said earlier that an EOF tar file was marked by a 
number of Zeros.

But I accept your more general point that most of the Archives Formats 
don't know when the Archive ends other than when their is no more data.

Yes, my FilterInputStream is feeding the TarArchiveInputStream.

With the Zip Format, getNextEntry() returns a null whereas for Tar it 
just blocks, using my FilterInputStream. I presume this is because the 
ZIP has already detected the end of the archive through its specific end 
of archive marker.

All your questions are sensible, and i'm not explaining in that well, 
because I’m not at the code and I’m doing it from memory.

The scenario I'm trying to cater for is as follows:-

Process 1 -> Slowly creates a Large Archive on the File System.

Process 2 -> Reads this Large Archive from the same File System.

If Process 2 is Faster than Process 1 it will hit an EOF and assume 
their are no more entries in the file. However, I need it to block until 
Process 1 is finished. Hence to support this behaviour I need to 
implement blocking with FilterInputStream. This works better with Zip 
coz it knows when the archive has finished and can cleanup the blocking 
reading process. Doesn't look we can be so clean with the Tar Archive 


> Tar File EOF not being detected
> -------------------------------
>                 Key: COMPRESS-384
>                 URL:
>             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

View raw message