KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > XFile


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util;
11
12 import java.io.File JavaDoc;
13
14 /**
15  * Retrieves the file properties from a File object and stores them as fields.
16  * Eg: the files' modification time will be stored as a moddate long variabele.
17  *
18  * @author David V van Zeventer
19  * @deprecated What's wrong with java.io.File itself? The only difference is that lastmodified gives last-modified not of file now, but of file when this object was created. If that is important, the name (nor javadoc) of this class is not very informative.
20  * @application SCAN or Devices
21  * @version $Id: XFile.java,v 1.8 2004/09/30 08:52:16 pierre Exp $
22  */

23 public class XFile {
24
25     /**
26      * The File itself
27      */

28     private File JavaDoc file=null;
29     /**
30      * The file path of the file
31      */

32     private String JavaDoc filepath=null;
33     /**
34      * The modification time of the file
35      */

36     private long modtime=0;
37
38     /**
39      * Creates a XFile object
40      * @param f the File to store the values of.
41      */

42     public XFile(File JavaDoc f) {
43         filepath = f.getPath(); // Get filepath.
44
modtime = f.lastModified(); // Get modificationtime.
45
}
46
47     /**
48      * Creates a XFile object
49      * @param filepath the path of the file to store the values of.
50      */

51     public XFile(String JavaDoc filepath) {
52         file = new File JavaDoc(filepath); // Create fileobject.
53
this.filepath = file.getPath(); // Get filepath.
54
modtime = file.lastModified(); // Get modificationtime.
55
}
56
57
58     /**
59      * Retrieves the file path.
60      */

61     public String JavaDoc getFilePath() {
62         return filepath;
63     }
64
65     /**
66      * Retrieves the modification time
67      */

68     public long getModTime() {
69         return modtime;
70     }
71 }
72
Popular Tags