public class URLResource extends Resource
Modifier and Type | Field and Description |
---|---|
protected URLConnection |
_connection |
protected InputStream |
_in |
protected URL |
_url |
protected String |
_urlString |
__defaultUseCaches
Modifier | Constructor and Description |
---|---|
protected |
URLResource(URL url,
URLConnection connection) |
protected |
URLResource(URL url,
URLConnection connection,
boolean useCaches) |
Modifier and Type | Method and Description |
---|---|
Resource |
addPath(String path)
Returns the resource contained inside the current resource with the
given name
|
protected boolean |
checkConnection() |
void |
close()
Release any resources held by the resource.
|
boolean |
delete()
Deletes the given resource
|
boolean |
equals(Object o) |
boolean |
exists()
Returns true if the represented resource exists.
|
File |
getFile()
Returns an File representing the given resource or NULL if this
is not possible.
|
InputStream |
getInputStream()
Returns an input stream to the resource.
|
protected InputStream |
getInputStream(boolean resetConnection)
Returns an input stream to the resource, optionally nulling
out the underlying url connection.
|
String |
getName()
Returns the name of the resource
|
ReadableByteChannel |
getReadableByteChannel()
Returns an readable bytechannel to the resource or null if one is not available.
|
URL |
getURL()
Returns an URL representing the given resource
|
boolean |
getUseCaches() |
int |
hashCode() |
boolean |
isContainedIn(Resource containingResource) |
boolean |
isDirectory()
Returns true if the represented resource is a container/directory.
|
long |
lastModified()
Returns the last modified time
|
long |
length()
Return the length of the resource
|
String[] |
list()
Returns a list of resource names contained in the given resource
|
boolean |
renameTo(Resource dest)
Rename the given resource
|
String |
toString() |
copyTo, encode, finalize, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeTo
protected final URL _url
protected final String _urlString
protected URLConnection _connection
protected InputStream _in
protected URLResource(URL url, URLConnection connection)
protected URLResource(URL url, URLConnection connection, boolean useCaches)
protected boolean checkConnection()
public void close()
public boolean exists()
public boolean isDirectory()
isDirectory
in class Resource
public long lastModified()
lastModified
in class Resource
public long length()
public URL getURL()
public File getFile() throws IOException
getFile
in class Resource
IOException
public String getName()
public InputStream getInputStream() throws IOException
getInputStream
in class Resource
IOException
protected InputStream getInputStream(boolean resetConnection) throws IOException
resetConnection
- if true the connection field is set to nullIOException
public ReadableByteChannel getReadableByteChannel() throws IOException
Resource
getReadableByteChannel
in class Resource
IOException
public boolean delete() throws SecurityException
delete
in class Resource
SecurityException
public boolean renameTo(Resource dest) throws SecurityException
renameTo
in class Resource
SecurityException
public String[] list()
public Resource addPath(String path) throws IOException, MalformedURLException
addPath
in class Resource
path
- The path segment to add, which is not encodedIOException
MalformedURLException
public boolean getUseCaches()
public boolean isContainedIn(Resource containingResource) throws MalformedURLException
isContainedIn
in class Resource
MalformedURLException
Copyright © 1995-2015 Webtide. All Rights Reserved.