public class URIHandlerImpl extends java.lang.Object implements URIHandler
URI handler
.DEFAULT_HANDLERS
Constructor and Description |
---|
URIHandlerImpl()
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(URI uri)
This implementation always returns true; clients are generally expected to override this.
|
java.util.Map<java.lang.String,?> |
contentDescription(URI uri,
java.util.Map<?,?> options)
This implementation delegates to the
URI converter 's content handlers . |
java.io.InputStream |
createInputStream(URI uri,
java.util.Map<?,?> options)
Creates an input stream for the URI, assuming it's a URL, and returns it.
|
java.io.OutputStream |
createOutputStream(URI uri,
java.util.Map<?,?> options)
Creates an output stream for the URI, assuming it's a URL, and returns it.
|
void |
delete(URI uri,
java.util.Map<?,?> options)
Only HTTP connections support delete.
|
boolean |
exists(URI uri,
java.util.Map<?,?> options)
If a stream can be created the file exists.
|
java.util.Map<java.lang.String,?> |
getAttributes(URI uri,
java.util.Map<?,?> options)
Returns a map from String attributes to their corresponding values representing information about various aspects of the URI's state.
|
protected java.util.Set<java.lang.String> |
getRequestedAttributes(java.util.Map<?,?> options)
Returns the value of the
requested attributes option . |
protected java.util.Map<java.lang.Object,java.lang.Object> |
getResponse(java.util.Map<?,?> options)
Returns the value of the
response option . |
protected int |
getTimeout(java.util.Map<?,?> options)
Returns the value of the
timeout option . |
protected URIConverter |
getURIConverter(java.util.Map<?,?> options)
Returns the value of the
URI converter option . |
void |
setAttributes(URI uri,
java.util.Map<java.lang.String,?> attributes,
java.util.Map<?,?> options)
Updates the map from String attributes to their corresponding values representing information about various aspects of the URI's state.
|
public boolean canHandle(URI uri)
canHandle
in interface URIHandler
uri
- the URI to consider.protected URIConverter getURIConverter(java.util.Map<?,?> options)
URI converter option
.options
- the options in which to look for the URI converter.protected java.util.Map<java.lang.Object,java.lang.Object> getResponse(java.util.Map<?,?> options)
response option
.options
- the options in which to look for the response option.protected java.util.Set<java.lang.String> getRequestedAttributes(java.util.Map<?,?> options)
requested attributes option
.options
- the options in which to look for the requested attributes option.protected int getTimeout(java.util.Map<?,?> options)
timeout option
.options
- the options in which to look for the timeout option.0
if not present.public java.io.OutputStream createOutputStream(URI uri, java.util.Map<?,?> options) throws java.io.IOException
createOutputStream
in interface URIHandler
uri
- the URI for which to create the output stream.options
- a map of options to influence the kind of stream that is returned; unrecognized options are ignored and null
is permitted.java.io.IOException
- if there is a problem obtaining an open output stream.URIConverter.createOutputStream(URI, Map)
public java.io.InputStream createInputStream(URI uri, java.util.Map<?,?> options) throws java.io.IOException
createInputStream
in interface URIHandler
uri
- the URI for which to create the input stream.options
- a map of options to influence the kind of stream that is returned; unrecognized options are ignored and null
is permitted.java.io.IOException
- if there is a problem obtaining an open input stream.URIConverter.createInputStream(URI, Map)
public void delete(URI uri, java.util.Map<?,?> options) throws java.io.IOException
delete
in interface URIHandler
uri
- the URI to consider.options
- options to influence how the contents are deleted.java.io.IOException
- if there is a problem deleting the contents.URIConverter.delete(URI, Map)
public java.util.Map<java.lang.String,?> contentDescription(URI uri, java.util.Map<?,?> options) throws java.io.IOException
URI converter
's content handlers
.contentDescription
in interface URIHandler
uri
- the URI to consider.options
- options to influence how the content description is determined.java.io.IOException
- if there is a problem accessing the contents.URIConverter.contentDescription(URI, Map)
,
ContentHandler.contentDescription(URI, InputStream, Map, Map)
public boolean exists(URI uri, java.util.Map<?,?> options)
exists
in interface URIHandler
uri
- the URI to consider.options
- options to influence how the existence determined.URIConverter.exists(URI, Map)
public java.util.Map<java.lang.String,?> getAttributes(URI uri, java.util.Map<?,?> options)
URIHandler
requested attributes option
can be used to specify which properties to fetch;
without that option, all supported attributes will be fetched.
If the URI doesn't not support any particular attribute, an entry for that attribute will not be appear in the result.getAttributes
in interface URIHandler
uri
- the URI to consider.options
- options to influence how the attributes are determined.public void setAttributes(URI uri, java.util.Map<java.lang.String,?> attributes, java.util.Map<?,?> options) throws java.io.IOException
URIHandler
setAttributes
in interface URIHandler
uri
- the URI to consider.attributes
- the new values for the attributes.options
- options to influence how the attributes are updated.java.io.IOException
- if there is a problem updating the attributes.