- All Implemented Interfaces:
Serializable
,Comparable<Scheme>
,Constable
,org.refcodes.mixin.NameAccessor
,org.refcodes.mixin.PortAccessor
public enum Scheme
extends Enum<Scheme>
implements org.refcodes.mixin.NameAccessor, org.refcodes.mixin.PortAccessor
The
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).-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface org.refcodes.mixin.NameAccessor
org.refcodes.mixin.NameAccessor.NameBuilder<B extends org.refcodes.mixin.NameAccessor.NameBuilder<B>>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NameProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.PortAccessor
org.refcodes.mixin.PortAccessor.PortBuilder<B extends org.refcodes.mixin.PortAccessor.PortBuilder<B>>, org.refcodes.mixin.PortAccessor.PortMutator, org.refcodes.mixin.PortAccessor.PortProperty
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
firstMarkerIndex
(String aUrl) Returns the index of locator part pointing into the resource of the given URL.static Scheme
Returns thatScheme
represented by the given name.static Scheme
fromProtocol
(String aProtocol) Returns thatScheme
represented by the given protocol.static Scheme
fromScheme
(String aUrl) Determines theScheme
from the given URL.Returns the prefix for the resource locator as of theScheme
.getName()
int
getPort()
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.Returns protocol being the scheme name and the scheme specific part , e.g.Returns the locator part pointing into the resource of the given URL.Returns the locator part pointing into the resource of the given URL.static Scheme
Returns the enum constant of this class with the specified name.static Scheme[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
JAR
-
ZIP
-
SH
-
FILE
-
HTTP
-
HTTPS
-
SOCKS
-
SOCKS4
-
SOCKS5
-
UNKNOWN
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getName
- Specified by:
getName
in interfaceorg.refcodes.mixin.NameAccessor
-
getSpecific
Returns the scheme's specific part as of "name:scheme-specific-part". The double-slash "//" is the scheme-specific-part of "http://".- Returns:
- The scheme's specific part. For HTTP it would be "//".
-
toProtocol
Returns protocol being the scheme name and the scheme specific part , e.g. "http://" or "file:".- Returns:
- The protocol.
-
toUrl
Returns the locator part pointing into the resource of the given URL.- Parameters:
aUrl
- The URL from which to retrieve the locator part.aBeginIndex
- The index from where to start.- Returns:
- The locator part of the given URL or null if there is no valid resource protocol found.
-
toUrl
Returns the locator part pointing into the resource of the given URL.- Parameters:
aUrl
- The URL from which to retrieve the locator part.- Returns:
- The locator part of the given URL or null if there is no valid resource protocol found.
-
nextMarkerIndex
Returns the index of the locator part pointing into the resource of the given URL.- Parameters:
aUrl
- The URL from which to retrieve the locator part.aBeginIndex
- The index from where to start.- Returns:
- The index of locator part of the given URL or -1 if there is no valid resource protocol found.
-
firstMarkerIndex
Returns the index of locator part pointing into the resource of the given URL.- Parameters:
aUrl
- The URL from which to retrieve the locator part.- Returns:
- The the index locator part of the given URL or -1 if there is no valid resource protocol found.
-
getMarker
Returns the prefix for the resource locator as of theScheme
. E.g. a HTTP protocol will provide the resource locator prefix "http://" and a FILE protocol will provide the resource locator prefix "file:/" prefix.- Returns:
- The resource locator's prefix.
-
getPort
public int getPort()- Specified by:
getPort
in interfaceorg.refcodes.mixin.PortAccessor
-
fromName
Returns thatScheme
represented by the given name. -
fromProtocol
Returns thatScheme
represented by the given protocol. -
fromScheme
Determines theScheme
from the given URL.
-