1 16 package org.apache.commons.net.ftp; 17 import java.io.Serializable ; 18 import java.util.Calendar ; 19 20 40 41 public class FTPFile implements Serializable 42 { 43 44 public static final int FILE_TYPE = 0; 45 46 public static final int DIRECTORY_TYPE = 1; 47 48 public static final int SYMBOLIC_LINK_TYPE = 2; 49 50 public static final int UNKNOWN_TYPE = 3; 51 52 53 public static final int USER_ACCESS = 0; 54 55 public static final int GROUP_ACCESS = 1; 56 57 public static final int WORLD_ACCESS = 2; 58 59 60 public static final int READ_PERMISSION = 0; 61 62 public static final int WRITE_PERMISSION = 1; 63 67 public static final int EXECUTE_PERMISSION = 2; 68 69 int _type, _hardLinkCount; 70 long _size; 71 String _rawListing, _user, _group, _name, _link; 72 Calendar _date; 73 boolean[] _permissions[]; 74 75 76 public FTPFile() 77 { 78 _permissions = new boolean[3][3]; 79 _rawListing = null; 80 _type = UNKNOWN_TYPE; 81 _hardLinkCount = 0; 82 _size = 0; 83 _user = null; 84 _group = null; 85 _date = null; 86 _name = null; 87 } 88 89 90 96 public void setRawListing(String rawListing) 97 { 98 _rawListing = rawListing; 99 } 100 101 107 public String getRawListing() 108 { 109 return _rawListing; 110 } 111 112 113 119 public boolean isDirectory() 120 { 121 return (_type == DIRECTORY_TYPE); 122 } 123 124 130 public boolean isFile() 131 { 132 return (_type == FILE_TYPE); 133 } 134 135 141 public boolean isSymbolicLink() 142 { 143 return (_type == SYMBOLIC_LINK_TYPE); 144 } 145 146 152 public boolean isUnknown() 153 { 154 return (_type == UNKNOWN_TYPE); 155 } 156 157 158 164 public void setType(int type) 165 { 166 _type = type; 167 } 168 169 170 176 public int getType() 177 { 178 return _type; 179 } 180 181 182 187 public void setName(String name) 188 { 189 _name = name; 190 } 191 192 197 public String getName() 198 { 199 return _name; 200 } 201 202 203 207 public void setSize(long size) 208 { 209 _size = size; 210 } 211 212 213 218 public long getSize() 219 { 220 return _size; 221 } 222 223 224 230 public void setHardLinkCount(int links) 231 { 232 _hardLinkCount = links; 233 } 234 235 236 242 public int getHardLinkCount() 243 { 244 return _hardLinkCount; 245 } 246 247 248 254 public void setGroup(String group) 255 { 256 _group = group; 257 } 258 259 260 266 public String getGroup() 267 { 268 return _group; 269 } 270 271 272 278 public void setUser(String user) 279 { 280 _user = user; 281 } 282 283 289 public String getUser() 290 { 291 return _user; 292 } 293 294 295 301 public void setLink(String link) 302 { 303 _link = link; 304 } 305 306 307 314 public String getLink() 315 { 316 return _link; 317 } 318 319 320 327 public void setTimestamp(Calendar date) 328 { 329 _date = date; 330 } 331 332 333 338 public Calendar getTimestamp() 339 { 340 return _date; 341 } 342 343 344 355 public void setPermission(int access, int permission, boolean value) 356 { 357 _permissions[access][permission] = value; 358 } 359 360 361 371 public boolean hasPermission(int access, int permission) 372 { 373 return _permissions[access][permission]; 374 } 375 376 377 384 public String toString() 385 { 386 return _rawListing; 387 } 388 389 } 390 | Popular Tags |