public interface DataResource extends Resource
DataResource
is a simple resource that provides access to data. All
DataResource
s will implement the getInputStream()
method to provide
access to their data.
DataResource
s may optionally implement getUrl()
, which would return the
URL where the data is located. This may be necessary for some applications, but it is strongly
recommended the getInputStream()
be used whenever possible, because accessing the data
directly via the URL does not allow the ResourceManager to assist in caching or sharing of data.
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_RELATIVE_PATH_RESOLVER
Key for the initialization parameter whose value is a reference to the
RelativePathResolver that this DataResource should use to resolve relative resource
URLs. |
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_EXTERNAL_OVERRIDE_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object aObj)
Determines if this
DataResource is equal to another DataResource . |
InputStream |
getInputStream()
Gets an
InputStream to the data. |
URI |
getUri()
Gets the URI of the data.
|
URL |
getUrl()
Gets the URL where the data is stored.
|
int |
hashCode()
Gest the hash code for this
DataResource . |
destroy, getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, initialize, setLogger
static final String PARAM_RELATIVE_PATH_RESOLVER
RelativePathResolver
that this DataResource should use to resolve relative resource
URLs. This value is used as a key in the aAdditionalParams
Map that is passed to
the Resource.initialize(ResourceSpecifier,Map)
method.InputStream getInputStream() throws IOException
InputStream
to the data. It is the caller's responsibility to close this input
stream when finished with it.IOException
- if an I/O error occurred when trying to open the streamURI getUri()
getUrl()
. However, in the case where getUrl()
returns null
(indicating no URL available), this method may still return a URI. This can be the case if the
URI does not use a standard protocol such as http or file.URL getUrl()
getInputStream()
method be used whenever possible - see the class comment for more
information.boolean equals(Object aObj)
DataResource
is equal to another DataResource
.
It is important that DataResource
implementations override this method
appropriately, because the ResourceManager
can make use of this method to determine
when cached data can be reused. Two DataResource
s that are equal
according to this method will be considered to provide access to the same data; therefore, a
common cache can be used.int hashCode()
DataResource
. As always, if the
equals(Object)
method is overridden, this method should also be overridden. Two
objects that are equal
must have the same hash code.Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.