Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 16 17 package org.apache.naming.modules.fs; 18 19 import java.io.File ; 20 21 import javax.naming.directory.Attribute ; 22 import javax.naming.directory.BasicAttribute ; 23 import javax.naming.directory.BasicAttributes ; 24 25 30 public class FileAttributes extends BasicAttributes { 31 33 public FileAttributes(File file) { 34 this.file = file; 35 } 36 37 39 40 protected File file; 41 42 43 protected boolean accessed = false; 44 45 46 public static String CONTENT_LENGTH="contentLength"; 48 49 public Attribute get(String attrId) { 50 if( CONTENT_LENGTH.equalsIgnoreCase(attrId) ) { 51 return new BasicAttribute (CONTENT_LENGTH, new Long ( getContentLength() )); 53 } 54 return (super.get(attrId)); 55 } 56 57 58 61 69 72 77 public long getContentLength() { 78 long contentLength = file.length(); 79 return contentLength; 80 } 81 82 83 88 public long getCreation() { 89 long creation = file.lastModified(); 90 return creation; 91 } 92 93 98 public long getLastModified() { 99 long lastModified = file.lastModified(); 100 return lastModified; 101 } 102 103 108 } 116 117
| Popular Tags
|