public enum Protocol extends Enum<Protocol> implements org.refcodes.mixin.NameAccessor
Protocol
define values useful when working with files or a
file-system.Enum Constant and Description |
---|
FILE |
HTTP |
HTTPS |
JAR |
SH |
SOCKS |
SOCKS4 |
SOCKS5 |
ZIP |
Modifier and Type | Method and Description |
---|---|
int |
firstResourceLocatorIndex(String aUrl)
Returns the index of locator part pointing into the resource of the given
URL.
|
static Protocol |
fromName(String aName)
Returns that
Protocol represented by the given name. |
String |
getName() |
String |
getResourceLocatorPrefix()
Returns the prefix for the resource locator as of the
Protocol . |
int |
nextResourceLocatorIndex(String aUrl,
int aBeginIndex)
Returns the index of the locator part pointing into the resource of the
given URL.
|
String |
toPrefix()
Returns the path prefix for the protocol being the protocol name and the
protocol suffix (":"), e.g.
|
String |
toResourceLocator(String aUrl)
Returns the locator part pointing into the resource of the given URL.
|
String |
toResourceLocator(String aUrl,
int aBeginIndex)
Returns the locator part pointing into the resource of the given URL.
|
static Protocol |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Protocol[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Protocol JAR
public static final Protocol ZIP
public static final Protocol SH
public static final Protocol FILE
public static final Protocol HTTP
public static final Protocol HTTPS
public static final Protocol SOCKS
public static final Protocol SOCKS4
public static final Protocol SOCKS5
public static Protocol[] values()
for (Protocol c : Protocol.values()) System.out.println(c);
public static Protocol 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 toPrefix()
public String toResourceLocator(String aUrl, int aBeginIndex)
aUrl
- The URL from which to retrieve the locator part.aBeginIndex
- The index from where to start.public String toResourceLocator(String aUrl)
aUrl
- The URL from which to retrieve the locator part.public int nextResourceLocatorIndex(String aUrl, int aBeginIndex)
aUrl
- The URL from which to retrieve the locator part.aBeginIndex
- The index from where to start.public int firstResourceLocatorIndex(String aUrl)
aUrl
- The URL from which to retrieve the locator part.public String getResourceLocatorPrefix()
Protocol
.
E.g. a HTTP protocol will provide the resource locator prefix "http://"
and a FILE protocol will provide the resource locator prefix "file:/"
prefix.Copyright © 2018. All rights reserved.