Serializable
, Comparable<Scheme>
, org.refcodes.mixin.NameAccessor
, org.refcodes.mixin.PortAccessor
public enum Scheme extends Enum<Scheme> implements org.refcodes.mixin.NameAccessor, org.refcodes.mixin.PortAccessor
Scheme
define values useful when working with files or a
file-system. An URL-Scheme is constructed as follows:
"name:scheme-specific-part"
The name is the protocol of the scheme such as "file" or "http". The scheme
specific part is the part after the colon (":") specific to the given scheme.
For a "file" scheme it would be just an empty String
where as for
"http" it would be "//" (as of "http://", "http" being the name).Enum Constant | Description |
---|---|
FILE |
|
HTTP |
|
HTTPS |
|
JAR |
|
SH |
|
SOCKS |
|
SOCKS4 |
|
SOCKS5 |
|
UNKNOWN |
|
ZIP |
Modifier and Type | Method | Description |
---|---|---|
int |
firstMarkerIndex(String aUrl) |
Returns the index of locator part pointing into the resource of the given
URL.
|
static Scheme |
fromName(String aName) |
Returns that
Scheme represented by the given name. |
static Scheme |
fromProtocol(String aProtocol) |
Returns that
Scheme represented by the given protocol. |
static Scheme |
fromScheme(String aUrl) |
Determines the
Scheme from the given URL. |
String |
getMarker() |
Returns the prefix for the resource locator as of the
Scheme . |
String |
getName() |
|
int |
getPort() |
|
String |
getSpecific() |
Returns the scheme's specific part as of "name:scheme-specific-part".
|
int |
nextMarkerIndex(String aUrl,
int aBeginIndex) |
Returns the index of the locator part pointing into the resource of the
given URL.
|
String |
toProtocol() |
Returns protocol being the scheme name and the scheme specific part ,
e.g.
|
String |
toUrl(String aUrl) |
Returns the locator part pointing into the resource of the given URL.
|
String |
toUrl(String aUrl,
int aBeginIndex) |
Returns the locator part pointing into the resource of the given URL.
|
static Scheme |
valueOf(String name) |
Returns the enum constant of this type with the specified name.
|
static Scheme[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Scheme JAR
public static final Scheme ZIP
public static final Scheme SH
public static final Scheme FILE
public static final Scheme HTTP
public static final Scheme HTTPS
public static final Scheme SOCKS
public static final Scheme SOCKS4
public static final Scheme SOCKS5
public static final Scheme UNKNOWN
public static Scheme[] values()
for (Scheme c : Scheme.values()) System.out.println(c);
public static Scheme valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getName()
getName
in interface org.refcodes.mixin.NameAccessor
public String getSpecific()
public String toProtocol()
public String toUrl(String aUrl, int aBeginIndex)
aUrl
- The URL from which to retrieve the locator part.aBeginIndex
- The index from where to start.public String toUrl(String aUrl)
aUrl
- The URL from which to retrieve the locator part.public int nextMarkerIndex(String aUrl, int aBeginIndex)
aUrl
- The URL from which to retrieve the locator part.aBeginIndex
- The index from where to start.public int firstMarkerIndex(String aUrl)
aUrl
- The URL from which to retrieve the locator part.public String getMarker()
Scheme
.
E.g. a HTTP protocol will provide the resource locator prefix "http://"
and a FILE protocol will provide the resource locator prefix "file:/"
prefix.public int getPort()
getPort
in interface org.refcodes.mixin.PortAccessor
public static Scheme fromName(String aName)
Scheme
represented by the given name.public static Scheme fromProtocol(String aProtocol)
Scheme
represented by the given protocol.Copyright © 2018. All rights reserved.