@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 |
| 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() |
URI |
getAsURI() |
URL |
getAsURL() |
InputStream |
getInputStream()
Get the input stream to read from the object.
|
InputStream |
getInputStream(IMutableWrapper<IOException> aExceptionHolder) |
InputStream |
getInputStream(int nConnectTimeoutMS,
int nReadTimeoutMS) |
InputStream |
getInputStream(int nConnectTimeoutMS,
int nReadTimeoutMS,
Consumer<URLConnection> aConnectionModifier,
IMutableWrapper<IOException> aExceptionHolder) |
InputStream |
getInputStream(int nConnectTimeoutMS,
int nReadTimeoutMS,
IMutableWrapper<IOException> aExceptionHolder) |
static InputStream |
getInputStream(URL aURL) |
String |
getPath() |
URLResource |
getReadableCloneForPath(String sPath)
Get a new resource of the same implementation type as this object but for a
different path.
|
URLResource |
getReadableCloneForPath(URL aURL) |
String |
getResourceID() |
int |
hashCode() |
static boolean |
isExplicitURLResource(String sName)
Check if the passed resource name is an explicit URL resource.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetReaderpublic 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()
IHasInputStreamInputStream needs to be created!getInputStream in interface IHasInputStreamnull if resolving failed.@Nullable public InputStream getInputStream(@CheckForSigned int nConnectTimeoutMS, @CheckForSigned int nReadTimeoutMS)
@Nullable public InputStream getInputStream(@Nullable IMutableWrapper<IOException> aExceptionHolder)
@Nullable public InputStream getInputStream(@CheckForSigned int nConnectTimeoutMS, @CheckForSigned int nReadTimeoutMS, @Nullable IMutableWrapper<IOException> aExceptionHolder)
@Nullable public InputStream getInputStream(@CheckForSigned int nConnectTimeoutMS, @CheckForSigned int nReadTimeoutMS, @Nullable Consumer<URLConnection> aConnectionModifier, @Nullable IMutableWrapper<IOException> aExceptionHolder)
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)
IReadableResourcegetReadableCloneForPath in interface IReadableResourcesPath - The new path to use. May not be null.null.Copyright © 2014–2017 Philip Helger. All rights reserved.