Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 47654 invoked from network); 5 Apr 2005 17:22:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Apr 2005 17:22:28 -0000 Received: (qmail 48271 invoked by uid 500); 5 Apr 2005 17:22:25 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 47929 invoked by uid 500); 5 Apr 2005 17:22:24 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 47908 invoked by uid 500); 5 Apr 2005 17:22:23 -0000 Received: (qmail 47902 invoked by uid 99); 5 Apr 2005 17:22:23 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 05 Apr 2005 10:22:23 -0700 Received: (qmail 47566 invoked by uid 65534); 5 Apr 2005 17:22:22 -0000 Message-ID: <20050405172222.47565.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Tue, 05 Apr 2005 17:22:22 -0000 Subject: svn commit: r160202 - in jakarta/commons/proper/io/trunk: project.xml src/java/org/apache/commons/io/input/CountingInputStream.java src/test/org/apache/commons/io/input/CountingInputStreamTest.java To: commons-cvs@jakarta.apache.org From: roxspring@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: roxspring Date: Tue Apr 5 10:22:21 2005 New Revision: 160202 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D160202 Log: CountingInputStream now implements skip(long) method. PR: 34311 Modified: jakarta/commons/proper/io/trunk/project.xml jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/Co= untingInputStream.java jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/Co= untingInputStreamTest.java Modified: jakarta/commons/proper/io/trunk/project.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/project.= xml?view=3Ddiff&r1=3D160201&r2=3D160202 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/io/trunk/project.xml (original) +++ jakarta/commons/proper/io/trunk/project.xml Tue Apr 5 10:22:21 2005 @@ -16,7 +16,7 @@ --> 3 - =20 + IO commons-io 1.1-dev @@ -26,7 +26,7 @@ Commons-IO contains utility classes, stream implementations, file = filters, and endian classes. /images/io-logo-white.png - =20 + http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/ org.apache.commons.${pom.artifactId.substring(8)} =20 @@ -43,18 +43,18 @@ repo - =20 + jakarta http://issues.apache.org/bugzilla/ jakarta.apache.org /www/jakarta.apache.org/commons/${pom.artifactId.substrin= g(8)}/ /www/jakarta.apache.org/builds/jakarta-commons/${= pom.artifactId.substring(8)}/ - =20 + scm:svn:http://svn.apache.org/repos/asf/jakarta/commons/pr= oper/${pom.artifactId.substring(8)}/trunk http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.arti= factId.substring(8)}/trunk - =20 + Commons Dev List @@ -69,7 +69,7 @@ http://mail-archives.apache.org/eyebrowse/SummarizeList?lis= tName=3Dcommons-user@jakarta.apache.org - =20 + 1.0 @@ -146,6 +146,15 @@ Martin Cooper martinc martinc@apache.org + + + Java Developer + + + + Rob Oxspring + roxspring + roxspring@apache.org Java Developer Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/in= put/CountingInputStream.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/java= /org/apache/commons/io/input/CountingInputStream.java?view=3Ddiff&r1=3D1602= 01&r2=3D160202 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/Co= untingInputStream.java (original) +++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/input/Co= untingInputStream.java Tue Apr 5 10:22:21 2005 @@ -71,6 +71,17 @@ this.count +=3D (found >=3D 0) ? 1 : 0; return found; } + =20 + /** + * Increases the count by the number of skipped bytes. + *=20 + * @see java.io.InputStream#skip(long) + */ + public long skip(final long length) throws IOException { + final long skip =3D super.skip(length); + this.count +=3D skip; + return skip; + } =20 /** * The number of bytes that have passed through this stream. Modified: jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/in= put/CountingInputStreamTest.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/test= /org/apache/commons/io/input/CountingInputStreamTest.java?view=3Ddiff&r1=3D= 160201&r2=3D160202 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/Co= untingInputStreamTest.java (original) +++ jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/input/Co= untingInputStreamTest.java Tue Apr 5 10:22:21 2005 @@ -17,6 +17,8 @@ package org.apache.commons.io.input; =20 import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.Arrays; =20 import junit.framework.TestCase; =20 @@ -148,6 +150,21 @@ int found =3D cis.read(result, 0, 5); assertEquals(2, found); assertEquals(2, cis.getCount()); + } + =20 + public void testSkipping() throws IOException { + String text =3D "Hello World!"; + byte[] bytes =3D text.getBytes(); + ByteArrayInputStream bais =3D new ByteArrayInputStream(bytes); + CountingInputStream cis =3D new CountingInputStream(bais); + =20 + assertEquals(6,cis.skip(6)); + assertEquals(6,cis.getCount()); + final byte[] result =3D new byte[6]; + cis.read(result); + =20 + assertEquals("World!",new String(result)); + assertEquals(12,cis.getCount()); } =20 } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org