public class ExternalResource extends AbstractFileResolvingResource
| Constructor and Description |
|---|
ExternalResource(String path)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
exists()
This implementation checks whether a File can be opened,
falling back to whether an InputStream can be opened.
|
String |
getDescription() |
InputStream |
getInputStream()
Return an
InputStream. |
String |
getPath()
Gets the path
|
URL |
getURL()
This implementation returns a URL for the underlying class path resource.
|
boolean |
isDirectory()
Tests whether the file denoted by this abstract pathname is a
directory.
|
contentLength, customizeConnection, customizeConnection, getFile, getFileForLastModifiedCheck, isReadable, lastModifiedcreateRelative, equals, getFilename, getURI, hashCode, isOpen, toStringpublic ExternalResource(String path)
path - the path to the external resourcepublic boolean isDirectory()
public boolean exists()
AbstractResourceexists in interface Resourceexists in class AbstractFileResolvingResourcepublic String getDescription()
Implementations are also encouraged to return this value
from their toString method.
Object.toString()public InputStream getInputStream() throws IOException
InputStreamResourceInputStream.
It is expected that each call creates a fresh stream.
This requirement is particularly important when you consider an API such
as JavaMail, which needs to be able to read the stream multiple times when
creating mail attachments. For such a use case, it is required
that each getInputStream() call returns a fresh stream.
null)IOException - if the stream could not be openedpublic URL getURL() throws IOException
getURL in interface ResourcegetURL in class AbstractResourceIOException - if the resource cannot be resolved as URL,
i.e. if the resource is not available as descriptorClassLoader.getResource(String),
Class.getResource(String)public String getPath()
Copyright © 2015. All rights reserved.