Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 95026 invoked from network); 2 Nov 2008 09:22:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2008 09:22:05 -0000 Received: (qmail 30054 invoked by uid 500); 2 Nov 2008 09:22:10 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 30028 invoked by uid 500); 2 Nov 2008 09:22:10 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 30017 invoked by uid 99); 2 Nov 2008 09:22:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Nov 2008 01:22:10 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Nov 2008 09:21:03 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 48633234C260 for ; Sun, 2 Nov 2008 01:21:44 -0800 (PST) Message-ID: <1851828217.1225617704295.JavaMail.jira@brutus> Date: Sun, 2 Nov 2008 01:21:44 -0800 (PST) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-3770) Create a utility class for skipping data in an InputStream In-Reply-To: <1159217300.1215611612234.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644579#action_12644579 ] Knut Anders Hatlen commented on DERBY-3770: ------------------------------------------- Committed revision 709856. > Create a utility class for skipping data in an InputStream > ---------------------------------------------------------- > > Key: DERBY-3770 > URL: https://issues.apache.org/jira/browse/DERBY-3770 > Project: Derby > Issue Type: Improvement > Components: Miscellaneous > Affects Versions: 10.5.0.0 > Reporter: Kristian Waagan > Assignee: Junjie Peng > Priority: Minor > Attachments: derby-3770-1.patch, derby-3770-1.stat, derby-3770-2.patch, derby-3770-2.stat, derby-3770-3.patch, derby-3770-3.stat, derby-3770-4.patch, derby-3770-4.patch, derby-3770-4.stat, derby-3770-4.stat, derby-3770-5.patch, derby-3770-5.stat, derby-3770-6.patch, derby-3770-6.stat, derby-3770-use-1a.diff > > > The contract of InputStream.skip is somewhat difficult, some would even say broken. > See http://java.sun.com/javase/6/docs/api/java/io/InputStream.html#skip(long)) > A utility class should be created to ensure that we use the same skip procedure throughout the Derby code base. > Suggested functionality: > - long skipFully(InputStream) : skips until EOF, returns number of bytes skipped > - void skipFully(InputStream,long) : skips requested number of bytes, throws EOFException if there is too few bytes in the stream > I know of two different approaches, both skipping in a loop: > a) Verify EOF with a read call when skip returns zero. > b) Throw EOFException if skip returns zero before requested number of bytes have been skipped. > There's related code in iapi.util.UTF8Util. Maybe this class, say StreamUtil, could be put in the same package? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.