KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > drftpd > remotefile > AbstractRemoteFile


1 /*
2  * This file is part of DrFTPD, Distributed FTP Daemon.
3  *
4  * DrFTPD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * DrFTPD 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  * You should have received a copy of the GNU General Public License
15  * along with DrFTPD; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package net.sf.drftpd.remotefile;
19
20 /**
21  * @author mog
22  * @version $Id: AbstractRemoteFile.java,v 1.1 2004/04/17 02:24:38 mog Exp $
23  */

24 public abstract class AbstractRemoteFile implements RemoteFileInterface {
25     public boolean equals(Object JavaDoc file) {
26         if (!(file instanceof RemoteFileInterface))
27             return false;
28         return getPath().equals(((AbstractRemoteFile) file).getPath());
29     }
30
31     public String JavaDoc getGroupname() {
32             return "drftpd";
33     }
34
35     public RemoteFileInterface getLink() {
36         throw new UnsupportedOperationException JavaDoc();
37     }
38     
39     public String JavaDoc getUsername() {
40         return "drftpd";
41     }
42
43     public long getXfertime() {
44         throw new UnsupportedOperationException JavaDoc();
45     }
46
47     public boolean isDeleted() {
48         return false;
49     }
50
51     public int hashCode() {
52         return getName().hashCode();
53     }
54
55     public boolean isLink() {
56         return false;
57     }
58
59     public String JavaDoc toString() {
60         StringBuffer JavaDoc ret = new StringBuffer JavaDoc();
61         ret.append(getClass().getName()+"[");
62         if (isDirectory())
63             ret.append("[directory: true]");
64         if(isFile())
65             ret.append("[file: true]");
66         ret.append("[length(): "+this.length()+"]");
67         ret.append(getPath());
68         ret.append("]");
69         return ret.toString();
70     }
71
72     public String JavaDoc getLinkPath() {
73         return getLink().getPath();
74     }
75
76     public long getCheckSumCached() {
77         return 0;
78     }
79 }
80
Popular Tags