commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [jira] [Commented] (COMPRESS-280) [COMPRESS] Change TarInputStream Skip Behavior
Date Tue, 29 Apr 2014 00:42:14 GMT


BELUGA BEHR commented on COMPRESS-280:

Only for completeness sake.  I think that this library is a role-model for many people (myself
included), so I think it should keep to the specs and best practices.

"Clean Code: A Handbook of Agile Software Craftsmanship"
Clean Code... "does pretty much what you expected."  At this point, I expect a stream to adhere
to the InputStream definition of skip and I expect to have to wrapped the stream in IOUtils#skip

> [COMPRESS] Change TarInputStream Skip Behavior
> ----------------------------------------------
>                 Key: COMPRESS-280
>                 URL:
>             Project: Commons Compress
>          Issue Type: Improvement
>          Components: Archivers
>    Affects Versions: 1.8
>            Reporter: BELUGA BEHR
>            Priority: Minor
>             Fix For: 1.9
>         Attachments:
> InputStream#skip declares:
> {quote}
> Skips over and discards n bytes of data from this input stream. The skip method may,
for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. 
This may result from any of a number of conditions; reaching end of file before n bytes have
been skipped is only one possibility. The actual number of bytes skipped is returned.  If
n is negative, no bytes are skipped.
> {quote}
> I would recommend doing away with the call to the local IOUtils in the Stream's skip
method and just call skip directly on the underlying stream.  I'd also amend the JavaDoc to
say "end up skipping .. some smaller number of bytes... reaching the end of the current entry."
 The stream is not required to make any best-effort.  For your example, there should be a
BufferedInputStream between the TarInputStream and the CipherInputStream.  This would put
it more in line with all other InputStreams.
> If a client wants to skip an entry manually, they would have to call Commons-IO IOUtils#skipFully,
IOUtils#skip, etc.
> You would then have to modify getNextTarEntry() to call the IOUtils#skip method.

This message was sent by Atlassian JIRA

View raw message