KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcifs > smb > SmbShareInfo


1 /* jcifs smb client library in Java
2  * Copyright (C) 2007 "Michael B. Allen" <jcifs at samba dot org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package jcifs.smb;
20
21 import jcifs.util.Hexdump;
22
23 public class SmbShareInfo implements FileEntry {
24
25     protected String JavaDoc netName;
26     protected int type;
27     protected String JavaDoc remark;
28
29     public String JavaDoc getName() {
30         return netName;
31     }
32     public int getType() {
33         /* 0x80000000 means hidden but SmbFile.isHidden() checks for $ at end
34          */

35         switch (type & 0xFFFF) {
36             case 1:
37                 return SmbFile.TYPE_PRINTER;
38             case 3:
39                 return SmbFile.TYPE_NAMED_PIPE;
40         }
41         return SmbFile.TYPE_SHARE;
42     }
43     public int getAttributes() {
44         return SmbFile.ATTR_READONLY | SmbFile.ATTR_DIRECTORY;
45     }
46     public long createTime() {
47         return 0L;
48     }
49     public long lastModified() {
50         return 0L;
51     }
52     public long length() {
53         return 0L;
54     }
55
56     public boolean equals(Object JavaDoc obj) {
57         if (obj instanceof SmbShareInfo) {
58             SmbShareInfo si = (SmbShareInfo)obj;
59             return netName.equals(si.netName);
60         }
61         return false;
62     }
63     public int hashCode() {
64         int hashCode = netName.hashCode();
65         return hashCode;
66     }
67
68     public String JavaDoc toString() {
69         return new String JavaDoc( "SmbShareInfo[" +
70                 "netName=" + netName +
71                 ",type=0x" + Hexdump.toHexString( type, 8 ) +
72                 ",remark=" + remark + "]" );
73     }
74 }
75
Popular Tags