<snip>
>
> public static LoginLog[] readLog()throws FileNotFoundException
> {
> Vector log = new Vector();
>
> try {
> FileReader inFile = new FileReader( "/var/log/GFWlogin.log" );
> BufferedReader bfFile = new BufferedReader( inFile );
> while ( bfFile.ready() ) {
> LoginLog logentry = getLogentry( bfFile );
> log.add( logentry );
> }
> bfFile.close();
> } catch ( IOException e ) {} ;
> return (LoginLog[])log.toArray( new LoginLog[log.size()] );
> }
>
Why not simply use:
String line = null;
while ((line = bfFile.readLine()) != null) {
LoginLog logEntry = getLogEntry(line); // Create log entry from the
line just read.
log.add(logEntry);
}
There is no need to use 'bfFile.ready()'. This method only checks
whether the call to a read method may block, which is not a problem
at all.
Regards,
Ronald.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]