1 21 package net.mlw.vlh.adapter.file; 22 23 import java.io.File ; 24 import java.util.Date ; 25 26 30 public class FileInfo 31 { 32 33 private File file; 34 35 39 public FileInfo(File file) 40 { 41 this.file = file; 42 } 43 44 46 public Date getLastModified() 47 { 48 return new Date (file.lastModified()); 49 } 50 51 53 public String getName() 54 { 55 return file.getName(); 56 } 57 58 62 public String getExtention() 63 { 64 return (getName().lastIndexOf('.') != -1) ? getName().substring(getName().lastIndexOf('.'), getName().length()) : ""; 65 } 66 67 69 public long getLength() 70 { 71 return file.length(); 72 } 73 74 76 public boolean getDirectory() 77 { 78 return file.isDirectory(); 79 } 80 81 83 public boolean getReadable() 84 { 85 return file.canRead(); 86 } 87 88 89 public boolean getWritable() 90 { 91 return file.canWrite(); 92 } 93 94 95 public String getAbsolutePath() 96 { 97 return file.getAbsolutePath(); 98 } 99 100 102 public String toString() 103 { 104 return file.getName() + " " + super.toString(); 105 } 106 107 } 108 | Popular Tags |