1 package org.mortbay.util; 16 17 import java.io.File ; 18 import java.io.FileNotFoundException ; 19 import java.io.IOException ; 20 import java.io.InputStream ; 21 import java.io.OutputStream ; 22 import java.net.URL ; 23 24 25 26 34 class BadResource extends URLResource 35 { 36 37 private String _message=null; 38 39 40 BadResource(URL url, String message) 41 { 42 super(url,null); 43 _message=message; 44 } 45 46 47 48 public boolean exists() 49 { 50 return false; 51 } 52 53 54 public long lastModified() 55 { 56 return -1; 57 } 58 59 60 public boolean isDirectory() 61 { 62 return false; 63 } 64 65 66 public long length() 67 { 68 return -1; 69 } 70 71 72 73 public File getFile() 74 { 75 return null; 76 } 77 78 79 public InputStream getInputStream() throws IOException 80 { 81 throw new FileNotFoundException (_message); 82 } 83 84 85 public OutputStream getOutputStream() 86 throws java.io.IOException , SecurityException 87 { 88 throw new FileNotFoundException (_message); 89 } 90 91 92 public boolean delete() 93 throws SecurityException 94 { 95 throw new SecurityException (_message); 96 } 97 98 99 public boolean renameTo( Resource dest) 100 throws SecurityException 101 { 102 throw new SecurityException (_message); 103 } 104 105 106 public String [] list() 107 { 108 return null; 109 } 110 111 112 public String toString() 113 { 114 return super.toString()+"; BadResource="+_message; 115 } 116 117 } 118 | Popular Tags |