java.lang.Object | |
↳ | chan.content.ChanLocator |
Provides URI handling and building.
In the first you must declare chan hosts. You can do this using addChanHost(String)
method.
If you add more than one host, user can choice one of them in preferences.
If you want to add special host that user might not choice, use addSpecialChanHost(String)
.
This method is used for special hosts like JSON API or host for static data, for example.
There is the list of methods you must override:
isBoardUri(Uri)
isThreadUri(Uri)
isAttachmentUri(Uri)
getBoardName(Uri)
getThreadNumber(Uri)
getPostNumber(Uri)
createBoardUri(String, int)
createThreadUri(String, String)
createPostUri(String, String, String)
URI building with preferred configuration provided by the following methods:
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ChanLocator.HttpsMode | HTTPS mode, used in |
||||||||||
ChanLocator.NavigationData | Navigation data holder. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Declares host as chan host. | |||||||||||
Declares host as chan host. | |||||||||||
Declares host as chan host. | |||||||||||
Builds URI with given path segments and preferred host and scheme. | |||||||||||
Builds URI with given host and path segments and preferred scheme. | |||||||||||
Builds URI with given scheme, host and path segments. | |||||||||||
Builds URI with given path and parameters and preferred host and scheme. | |||||||||||
Builds URI with given host, path and parameters and preferred scheme. | |||||||||||
Builds URI with given scheme, host, path and parameters. | |||||||||||
Calls when client intend to obtain a file name from URI. | |||||||||||
Calls when client intend to create board URI. | |||||||||||
Calls when client intend to create thread URI with anchor to post. | |||||||||||
Calls when client intend to create thread URI. | |||||||||||
Return linked | |||||||||||
Returns board name from given URI. | |||||||||||
Returns extension of file with given path. | |||||||||||
Finds given pattern in string and returns group by index. | |||||||||||
Returns post number from given URI. | |||||||||||
Returns thread number from given URI. | |||||||||||
Calls when client intend to handle link click. | |||||||||||
Returns whether URI is attachment URI. | |||||||||||
Returns whether path has audio extension. | |||||||||||
Returns whether URI is board URI. | |||||||||||
Returns whether URI's host is chan host or URI is relative (URI without scheme and host). | |||||||||||
Returns whether path has image extension. | |||||||||||
Returns whether URI's path matches to given pattern. | |||||||||||
Returns whether URI is thread URI. | |||||||||||
Returns whether HTTPS enabled in preferences. | |||||||||||
Returns whether path has video extension. | |||||||||||
Changes default HTTPS mode. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Declares host as chan host. This host might be default host in buildPath(String)
and
buildQuery(String, String)
methods. If you declare multiple hosts, user can choice one of them
in preferences. The first declared host will be chosen by default.
For example, a chan has 3 addresses: addr1.com
, addr2.com
, addr3.com
. If user choose
addr2.com
in preferences, URIs with the rest addresses will be converted to addr2.com
.
Parameters | |
---|---|
host |
String
|
Declares host as chan host. Unlike addChanHost(String)
user can't choice this host in preferences,
but it still can be converted. For example, it can be useful for old domains that don't work now.
Parameters | |
---|---|
host |
String
|
Declares host as chan host. Unlike addChanHost(String)
user can't choice this host in preferences
and and can't be converted. For example, it can be useful for special hosts like JSON API or static data.
Parameters | |
---|---|
host |
String
|
Builds URI with given path segments and preferred host and scheme.
Parameters | |
---|---|
segments |
String :
Path segments. |
Returns | |
---|---|
Uri |
URI. |
Builds URI with given host and path segments and preferred scheme.
Parameters | |
---|---|
host |
String :
URI host. |
segments |
String :
Path segments. |
Returns | |
---|---|
Uri |
URI. |
Builds URI with given scheme, host and path segments.
Parameters | |
---|---|
useHttps |
boolean :
Defines whether use HTTPS or not. |
host |
String :
URI host. |
segments |
String :
Path segments. |
Returns | |
---|---|
Uri |
URI. |
Builds URI with given path and parameters and preferred host and scheme.
Parameters | |
---|---|
path |
String :
URI path. |
alternation |
String :
Alternation of param's names and values (name, value, name, value...). |
Returns | |
---|---|
Uri |
URI. |
Builds URI with given host, path and parameters and preferred scheme.
Parameters | |
---|---|
host |
String :
URI host. |
path |
String :
URI path. |
alternation |
String :
Alternation of param's names and values (name, value, name, value...). |
Returns | |
---|---|
Uri |
URI. |
Builds URI with given scheme, host, path and parameters.
Parameters | |
---|---|
useHttps |
boolean :
Defines whether use HTTPS or not. |
host |
String :
URI host. |
path |
String :
URI path. |
alternation |
String :
Alternation of param's names and values (name, value, name, value...). |
Returns | |
---|---|
Uri |
URI. |
Calls when client intend to obtain a file name from URI. By default client obtains a name from last path segment of URI. You can override this behavior using this method.
Parameters | |
---|---|
fileUri |
Uri :
file URI |
Returns | |
---|---|
String |
File name. |
Calls when client intend to create board URI. You must override this method.
Parameters | |
---|---|
boardName |
String :
Board name. |
pageNumber |
int :
Number of page, might be PAGE_NUMBER_CATALOG . |
Returns | |
---|---|
Uri |
Board URI. |
Calls when client intend to create thread URI with anchor to post. You must override this method.
Parameters | |
---|---|
boardName |
String :
Board name. |
threadNumber |
String :
Thread number. |
postNumber |
String :
Post number. |
Returns | |
---|---|
Uri |
Post URI. |
Calls when client intend to create thread URI. You must override this method.
Parameters | |
---|---|
boardName |
String :
Board name. |
threadNumber |
String :
Thread number. |
Returns | |
---|---|
Uri |
Thread URI. |
Return linked ChanLocator
instance.
Parameters | |
---|---|
object |
Object :
Linked object: ChanConfiguration , ChanPerformer ,
ChanLocator or ChanMarkup . |
Returns | |
---|---|
T |
ChanLocator instance.
|
Returns board name from given URI. You must override this method.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
Returns | |
---|---|
String |
Board name. |
Returns extension of file with given path.
Parameters | |
---|---|
path |
String :
Path to inspect. |
Returns | |
---|---|
String |
File extension in lower case. |
Finds given pattern in string and returns group by index.
Parameters | |
---|---|
from |
String :
String to inspect. |
pattern |
Pattern :
Pattern to find. |
groupIndex |
int :
Index of group. |
Returns | |
---|---|
String |
First found value in string by group index. |
Returns post number from given URI. You must override this method.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
Returns | |
---|---|
String |
Posts number. |
Returns thread number from given URI. You must override this method.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
Returns | |
---|---|
String |
Thread number. |
Calls when client intend to handle link click. You can return ChanLocator.NavigationData
instance
with necessary navigation information.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
Returns | |
---|---|
ChanLocator.NavigationData |
ChanLocator.NavigationData instance or null.
|
Returns whether URI is attachment URI. You must override this method.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
Returns | |
---|---|
boolean |
True if URI is attachment URI. |
Returns whether path has audio extension.
Parameters | |
---|---|
path |
String :
Path to inspect. |
Returns | |
---|---|
boolean |
True if extension is audio's. |
Returns whether URI is board URI. You must override this method.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
Returns | |
---|---|
boolean |
True if URI is board URI. |
Returns whether URI's host is chan host or URI is relative (URI without scheme and host). This method will
return true for all URI's with hosts declared with addChanHost(String)
or
addSpecialChanHost(String)
methods and all relative URIs.
Parameters | |
---|---|
uri |
Uri
|
Returns | |
---|---|
boolean |
True if host is chan host or relative. |
Returns whether path has image extension.
Parameters | |
---|---|
path |
String :
Path to inspect. |
Returns | |
---|---|
boolean |
True if extension is image's. |
Returns whether URI's path matches to given pattern.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
pattern |
Pattern :
Pattern to match. |
Returns | |
---|---|
boolean |
True if URI's path matches to pattern. |
Returns whether URI is thread URI. You must override this method.
Parameters | |
---|---|
uri |
Uri :
URI to inspect. |
Returns | |
---|---|
boolean |
True if URI is thread URI. |
Returns whether HTTPS enabled in preferences.
Returns | |
---|---|
boolean |
True if HTTPS enabled. |
Returns whether path has video extension.
Parameters | |
---|---|
path |
String :
Path to inspect. |
Returns | |
---|---|
boolean |
True if extension is video's. |
Changes default HTTPS mode. By default it equals NO_HTTPS
.
Parameters | |
---|---|
httpsMode |
ChanLocator.HttpsMode
|
See also: