@Immutable public class URLResource extends Object implements IReadableResource
IReadableResource interface for URL objects.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CONNECT_TIMEOUT |
static int |
DEFAULT_READ_TIMEOUT |
static String |
PROTOCOL_FILE
The protocol for file resources
|
| Constructor and Description |
|---|
URLResource(ISimpleURL aURL) |
URLResource(String sURL) |
URLResource(URI aURI) |
URLResource(URL aURL) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
boolean |
exists() |
File |
getAsFile() |
static File |
getAsFile(URL aURL) |
URI |
getAsURI() |
URL |
getAsURL() |
InputStream |
getInputStream()
Get the input stream to read from the object.
|
InputStream |
getInputStream(int nConnectTimeoutMS,
int nReadTimeoutMS) |
InputStream |
getInputStream(int nConnectTimeoutMS,
int nReadTimeoutMS,
INonThrowingRunnableWithParameter<URLConnection> aConnectionModifier,
IWrapper<IOException> aExceptionHolder) |
InputStream |
getInputStream(int nConnectTimeoutMS,
int nReadTimeoutMS,
IWrapper<IOException> aExceptionHolder) |
InputStream |
getInputStream(IWrapper<IOException> aExceptionHolder) |
static InputStream |
getInputStream(URL aURL) |
String |
getPath() |
URLResource |
getReadableCloneForPath(String sPath) |
URLResource |
getReadableCloneForPath(URL aURL) |
Reader |
getReader(Charset aCharset)
Get an
Reader based on this input stream provider using the given
charset. |
Reader |
getReader(String sCharset)
Deprecated.
|
String |
getResourceID() |
int |
hashCode() |
static boolean |
isExplicitURLResource(String sName)
Check if the passed resource name is an explicit URL resource.
|
String |
toString() |
public static final String PROTOCOL_FILE
public static final int DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
public URLResource(@Nonnull ISimpleURL aURL) throws MalformedURLException
MalformedURLExceptionpublic URLResource(@Nonnull String sURL) throws MalformedURLException
MalformedURLExceptionpublic URLResource(@Nonnull URI aURI) throws MalformedURLException
MalformedURLExceptionpublic static boolean isExplicitURLResource(@Nullable String sName)
sName - The name to check. May be null.true if the passed name is an explicit URL resource.@Nonnull public String getResourceID()
getResourceID in interface IResourceBasenull resource ID used e.g. for system IDs in XML
resolving.@Nonnull public String getPath()
getPath in interface IResourceBasenull@Nullable public static InputStream getInputStream(@Nonnull URL aURL)
@Nullable public InputStream getInputStream()
IInputStreamProviderInputStream needs to be created!getInputStream in interface IInputStreamProvidernull if resolving failed.@Nullable public InputStream getInputStream(int nConnectTimeoutMS, int nReadTimeoutMS)
@Nullable public InputStream getInputStream(@Nullable IWrapper<IOException> aExceptionHolder)
@Nullable public InputStream getInputStream(int nConnectTimeoutMS, int nReadTimeoutMS, @Nullable IWrapper<IOException> aExceptionHolder)
@Nullable public InputStream getInputStream(int nConnectTimeoutMS, int nReadTimeoutMS, @Nullable INonThrowingRunnableWithParameter<URLConnection> aConnectionModifier, @Nullable IWrapper<IOException> aExceptionHolder)
@Nullable @Deprecated public Reader getReader(@Nonnull String sCharset)
IInputStreamAndReaderProviderReader based on this input stream provider using the given
charset.getReader in interface IInputStreamAndReaderProvidersCharset - The charset to use. May not be null.null if no input stream could be retrieved.@Nullable public Reader getReader(@Nonnull Charset aCharset)
IInputStreamAndReaderProviderReader based on this input stream provider using the given
charset.getReader in interface IInputStreamAndReaderProvideraCharset - The charset to use. May not be null.null if no input stream could be retrieved.public boolean exists()
exists in interface IResourceBasetrue if the resource exists, false
otherwise.@Nonnull public URL getAsURL()
getAsURL in interface IResourceBasenull
if this resource cannot be represented as an URL.@Nonnull public File getAsFile()
getAsFile in interface IResourceBasenull
if this resource cannot be represented as a file.@Nonnull public URLResource getReadableCloneForPath(@Nonnull URL aURL)
@Nonnull public URLResource getReadableCloneForPath(@Nonnull String sPath)
getReadableCloneForPath in interface IReadableResourceCopyright © 2006–2015 phloc systems. All rights reserved.