Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4F2B1118B9 for ; Fri, 25 Apr 2014 02:08:21 +0000 (UTC) Received: (qmail 20870 invoked by uid 500); 25 Apr 2014 02:08:16 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 20722 invoked by uid 500); 25 Apr 2014 02:08:15 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 20709 invoked by uid 99); 25 Apr 2014 02:08:14 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2014 02:08:14 +0000 Date: Fri, 25 Apr 2014 02:08:14 +0000 (UTC) From: "BELUGA BEHR (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (COMPRESS-277) IOUtils.skip does not work as advertised MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COMPRESS-277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] BELUGA BEHR updated COMPRESS-277: --------------------------------- Attachment: TarArchiveInputStream.java.patch > IOUtils.skip does not work as advertised > ---------------------------------------- > > Key: COMPRESS-277 > URL: https://issues.apache.org/jira/browse/COMPRESS-277 > Project: Commons Compress > Issue Type: Bug > Affects Versions: 1.8 > Reporter: Fabian Lange > Fix For: 1.9 > > Attachments: TarArchiveInputStream.java.patch > > > I am trying to feed a TarInputStream from a CipherInputStream. > It does not work, because IOUtils.skip() does not adhere to the contract it claims in javadoc: > " *

This method will only skip less than the requested number of > * bytes if the end of the input stream has been reached.

" > However it does: > long skipped = input.skip(numToSkip); > if (skipped == 0) { > break; > } > And the input stream javadoc says: > " * This may result from any of a number of conditions; reaching end of file > * before n bytes have been skipped is only one possibility." > In the case of CipherInputStream, it stops at the end of each byte buffer. > If you check the IOUtils from colleagues at commons-io, they have considered this case in IOUtils.skip() where they use a read to skip through the stream. > An optimized version could combine trying to skip, then read then trying to skip again. -- This message was sent by Atlassian JIRA (v6.2#6252)