Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 25915 invoked from network); 12 May 2006 02:18:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 May 2006 02:18:16 -0000 Received: (qmail 38296 invoked by uid 500); 12 May 2006 02:17:42 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 37865 invoked by uid 500); 12 May 2006 02:17:40 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 36847 invoked by uid 99); 12 May 2006 02:17:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 May 2006 19:17:33 -0700 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=DNS_FROM_RFC_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ejciramella@upromise.com designates 65.244.78.68 as permitted sender) Received: from [65.244.78.68] (HELO knight.corp.upromise.com) (65.244.78.68) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 May 2006 15:52:53 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Counting lines in a file Date: Thu, 11 May 2006 18:52:32 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Counting lines in a file Thread-Index: AcZ1QIYh5KGUw308TkOzFhcGDphmQQAC3k9AAABhoaA= From: "EJ Ciramella" To: "Ant Users List" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Nevermind - change Execute to execute and everything is well....=20 -----Original Message----- From: EJ Ciramella=20 Sent: Thursday, May 11, 2006 6:42 PM To: 'Ant Users List' Subject: RE: Counting lines in a file I'm not seeing the output from my class now (I know this is a simple/stupid thing on my part), what am I doing wrong: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; public class LineCounter extends Task { public String filename; public void Execute() throws BuildException { LineCounter lc =3D new LineCounter(); log("about to call countlines"); log(filename+ " contains " + lc.countLines(this.filename) +" lines."); } public void setFilename(String filename) { System.out.println("we are about to parse ->"+filename); this.filename=3D filename; } public int countLines(String file) { ArrayList integlist =3D new ArrayList(); try=20 { BufferedReader br =3D new BufferedReader(new FileReader(new File(file))); String line; while((line =3D br.readLine())!=3Dnull) { integlist.add(line); } System.out.println(integlist.size()); br.close(); } catch (Exception e)=20 { e.printStackTrace(); System.exit(-1); } return integlist.size(); } } -----Original Message----- From: Rich Wagner [mailto:rich.wagner@savaje.com]=20 Sent: Thursday, May 11, 2006 5:18 PM To: Ant Users List Subject: Re: Counting lines in a file > Is there any good way to count how many lines in a file there is? You could also write a simple, custom Task to do this; see the online=20 Ant manual for guidance... -- Rich Wagner --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org