|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KURIFilter
public class KURIFilter
Manages the filtering of URIs.
The intention of this plugin class is to allow people to extend the
functionality of KURL without modifying it directly. This way KURL will
remain a generic parser capable of parsing any generic URL that adheres
to specifications.
The KURIFilter class applies a number of filters to a URI and returns the
filtered version whenever possible. The filters are implemented using
plugins to provide easy extensibility of the filtering mechanism. New
filters can be added in the future by simply inheriting from
KURIFilterPlugin and implementing the KURIFilterPlugin.filterURI
method.
Use of this plugin-manager class is straight forward. Since it is a
singleton object, all you have to do is obtain an instance by doing
KURIFilter
.self() and use any of the public member functions to
preform the filtering.
xample
To simply filter a given string:
boolean filtered = KURIFilter.self().filterURI( "kde.org" );You can alternatively use a KURL:
KURL url = "kde.org"; boolean filtered = KURIFilter.self().filterURI( url );If you have a constant string or a constant URL, simply invoke the corresponding function to obtain the filtered string or URL instead of a booleanean flag:
String u = KURIFilter.self().filteredURI( "kde.org" );You can also restrict the filter(s) to be used by supplying the name of the filter(s) to use. By defualt all available filters will be used. To use specific filters, add the names of the filters you want to use to an ArrayList and invoke the appropriate filtering function. The examples below show the use of specific filters. The first one uses a single filter called kshorturifilter while the second example uses multiple filters:
String text = "kde.org"; boolean filtered = KURIFilter.self().filterURI( text, "kshorturifilter" );
ArrayList list; list << "kshorturifilter" << "localdomainfilter"; boolean filtered = KURIFilter.self().filterURI( text, list );KURIFilter also allows richer data exchange through a simple meta-object called
KURIFilterData.
Using this meta-object
you can find out more information about the URL you want to
filter. See KURIFilterData for examples and details.
Constructor Summary | |
---|---|
|
KURIFilter()
A protected constructor. |
protected |
KURIFilter(java.lang.Class dummy)
|
Method Summary | |
---|---|
void |
dispose()
Delete the wrapped C++ instance ahead of finalize() |
KURL |
filteredURI(KURL uri)
|
KURL |
filteredURI(KURL uri,
java.lang.String[] filters)
Returns the filtered URI. |
java.lang.String |
filteredURI(java.lang.String uri)
|
java.lang.String |
filteredURI(java.lang.String uri,
java.lang.String[] filters)
Return a filtered string representation of a URI. |
boolean |
filterURI(KURIFilterData data)
|
boolean |
filterURI(KURIFilterData data,
java.lang.String[] filters)
Filters the URI given by the object URIFilterData. |
boolean |
filterURI(KURL uri)
|
boolean |
filterURI(KURL uri,
java.lang.String[] filters)
Filters the URI given by the URL. |
boolean |
filterURI(java.lang.StringBuffer uri)
|
boolean |
filterURI(java.lang.StringBuffer uri,
java.lang.String[] filters)
Filters a string representing a URI. |
protected void |
finalize()
Deletes the wrapped C++ instance |
boolean |
isDisposed()
Has the wrapped C++ instance been deleted? |
protected void |
loadPlugins()
Loads all allowed plugins. |
java.util.ArrayList |
pluginNames()
Return a list of the names of all loaded plugins. |
static KURIFilter |
self()
Returns an instance of KURIFilter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected KURIFilter(java.lang.Class dummy)
public KURIFilter()
Method Detail |
---|
public boolean filterURI(KURIFilterData data, java.lang.String[] filters)
data
- object that contains the URI to be filtered.filters
- specify the list of filters to be used.
public boolean filterURI(KURIFilterData data)
public boolean filterURI(KURL uri, java.lang.String[] filters)
uri
- the URI to filter.filters
- specify the list of filters to be used.
public boolean filterURI(KURL uri)
public boolean filterURI(java.lang.StringBuffer uri, java.lang.String[] filters)
uri
- The URI to filter.filters
- specify the list of filters to be used.
public boolean filterURI(java.lang.StringBuffer uri)
public KURL filteredURI(KURL uri, java.lang.String[] filters)
uri
- The URI to filter.filters
- specify the list of filters to be used.
public KURL filteredURI(KURL uri)
public java.lang.String filteredURI(java.lang.String uri, java.lang.String[] filters)
uri
- the URI to filter.filters
- specify the list of filters to be used.
public java.lang.String filteredURI(java.lang.String uri)
public java.util.ArrayList pluginNames()
public static KURIFilter self()
protected void loadPlugins()
protected void finalize() throws java.lang.InternalError
finalize
in class java.lang.Object
java.lang.InternalError
public void dispose()
public boolean isDisposed()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |