From: Robert Klemme Date: 2003-04-04T00:15:00+09:00 Subject: Re: Newbie question:read file speed This is a multi-part message in MIME format. ------=_NextPart_000_0058_01C2F9E8.4D0690C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi Greg, out of curiosity, could you test the attached Java class and tell us whether it behaves differently than the one you provided? Thanks! Regards robert ------=_NextPart_000_0058_01C2F9E8.4D0690C0 Content-Type: text/x-java; name="Test.java" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Test.java" package io; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; /** * Read performance test. * * @author robert.klemme * @created 03.04.2003 * @version $Id$ */ public class Test { public static void main( String[] args ) { try { BufferedReader in =3D new BufferedReader( new InputStreamReader( new BufferedInputStream( new FileInputStream( args[0] ), 4096 ) ) ); int lc =3D 0; String line; long starttime =3D System.currentTimeMillis() / 1000; while ( ( line =3D in.readLine() ) !=3D null ) { lc +=3D 1; if ( ( lc % 1000 ) =3D=3D 0 ) { System.out.println( "Read " + lc + " lines" ); } } in.close(); long stoptime =3D System.currentTimeMillis() / 1000; System.out.println( "Elapsed =3D " + ( stoptime - starttime = ) ); } catch ( Exception e ) { e.printStackTrace(); } } } ------=_NextPart_000_0058_01C2F9E8.4D0690C0--