1 19 20 package org.netbeans.modules.javacore.scanning; 21 22 import java.io.IOException ; 23 import java.io.InputStream ; 24 import org.openide.ErrorManager; 25 import org.openide.filesystems.FileObject; 26 import org.openide.filesystems.FileUtil; 27 28 32 class FObjectInfo implements FileInfo { 33 FileObject fo; 34 35 FObjectInfo(FileObject f) { 36 fo=f; 37 } 38 39 public InputStream getInputStream() throws IOException { 40 return fo.getInputStream(); 41 } 42 43 public String getName() { 44 return fo.getNameExt(); 45 } 46 47 public String getPath() { 48 throw new UnsupportedOperationException (); 49 } 50 51 public boolean isDirectory() { 52 return false; 53 } 54 55 public long lastModified() { 56 return fo.lastModified().getTime(); 57 } 58 59 public FileInfo[] listFiles() { 60 return EMPTY_ARR; 61 } 62 63 public String getCanonicalName() { 64 try { 65 return FileUtil.toFile(fo).getCanonicalPath(); 66 } catch (Exception ex) { 67 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); 68 return getName(); 69 } 70 } 71 } 72 | Popular Tags |