KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > webEditor > util > log


1 /* $Id: log.java,v 1.3 2001/01/17 22:40:03 agarcia3 Exp $
2     webEditor. The new way in content management
3     Copyright (C) 2001 Alfredo Garcia
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     GNU General Public License for more details.
13 */

14
15 package webEditor.util;
16
17 import java.io.*;
18
19 /**
20  * Simple log file operations.
21  *
22  * Our intention is to use the same system
23  * to stored application events and system errors.
24  *
25  * @author <a HREF="mailto:agarcia@mundofree.com">Alfredo Garcia</a>
26  */

27 public class log
28 {
29    public log ()
30    {
31    }
32    
33    /**
34     * Read the content of a file in a single string
35     * @param file File to write
36     * @return void
37     */

38    public void errorLog (String JavaDoc file)
39    {
40     RandomAccessFile fileDesc;
41     String JavaDoc buffer = null;
42     String JavaDoc line = null;
43
44 try {
45     fileDesc = new RandomAccessFile (file,"r");
46     while ( (line = fileDesc.readLine() ) != null ) {
47         if ( buffer == null ) {
48             buffer = line + "\n";
49         }
50         else {
51             buffer = buffer + line + "\n";
52         }
53     }
54
55 } catch (Exception JavaDoc e) {
56     e.printStackTrace();
57 }
58    }
59    
60 }
61
Popular Tags