44 |
import java.io.FileInputStream; |
import java.io.FileInputStream; |
45 |
import java.io.FileNotFoundException; |
import java.io.FileNotFoundException; |
46 |
import java.io.FileOutputStream; |
import java.io.FileOutputStream; |
47 |
|
import java.io.FilePermission; |
48 |
import java.io.InputStream; |
import java.io.InputStream; |
49 |
import java.io.IOException; |
import java.io.IOException; |
50 |
import java.io.OutputStream; |
import java.io.OutputStream; |
51 |
import java.net.ProtocolException; |
import java.net.ProtocolException; |
52 |
import java.net.URL; |
import java.net.URL; |
53 |
import java.net.URLConnection; |
import java.net.URLConnection; |
54 |
|
import java.security.Permission; |
55 |
import java.util.AbstractSet; |
import java.util.AbstractSet; |
56 |
import java.util.Iterator; |
import java.util.Iterator; |
57 |
import java.util.Set; |
import java.util.Set; |
81 |
* OutputStream if we are writing to the file |
* OutputStream if we are writing to the file |
82 |
*/ |
*/ |
83 |
private BufferedOutputStream outputStream; |
private BufferedOutputStream outputStream; |
84 |
|
|
85 |
|
/** |
86 |
|
* FilePermission to read the file |
87 |
|
*/ |
88 |
|
private FilePermission permission; |
89 |
|
|
90 |
|
/** |
91 |
|
* Default permission for a file |
92 |
|
*/ |
93 |
|
private static final String DEFAULT_PERMISSION = "read"; |
94 |
|
|
95 |
/** |
/** |
96 |
* Calls superclass constructor to initialize. |
* Calls superclass constructor to initialize. |
97 |
*/ |
*/ |
101 |
|
|
102 |
/* Set up some variables */ |
/* Set up some variables */ |
103 |
doOutput = false; |
doOutput = false; |
104 |
|
|
105 |
|
permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION); |
106 |
} |
} |
107 |
|
|
108 |
/** |
/** |
209 |
|
|
210 |
|
|
211 |
/** |
/** |
212 |
|
* This method returns a <code>Permission</code> object representing the |
213 |
|
* permissions required to access this URL. This method returns a |
214 |
|
* <code>java.io.FilePermission</code> for the file's path with a read |
215 |
|
* permission. |
216 |
|
* |
217 |
|
* @return A Permission object |
218 |
|
*/ |
219 |
|
public Permission getPermission() throws IOException |
220 |
|
{ |
221 |
|
return permission; |
222 |
|
} |
223 |
|
|
224 |
|
/** |
225 |
* Does the resource pointed to actually exist? |
* Does the resource pointed to actually exist? |
226 |
*/ |
*/ |
227 |
public final boolean exists() |
public final boolean exists() |