Class FilePlexusResource
- All Implemented Interfaces:
PlexusResource
PlexusResource
for files.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFile()
Returns the resource as a file, if possible.Returns the resource as anInputStream
.getName()
Returns the resources name, if possible.getURI()
Returns the resources URI, if possible.getURL()
Returns the resources URL, if possible.
-
Field Details
-
file
-
-
Constructor Details
-
FilePlexusResource
-
-
Method Details
-
getFile
Description copied from interface:PlexusResource
Returns the resource as a file, if possible. A resource doesn't need to be available as a file: If you require a file, use
ResourceManager.getResourceAsFile(PlexusResource)
.- Specified by:
getFile
in interfacePlexusResource
- Returns:
- A
File
containing the resources contents, if available, or null.
-
getInputStream
Description copied from interface:PlexusResource
Returns the resource as an
InputStream
. In general, you should not assume, that this method may me called more than once. In typical cases (for example, if the Resource is backed by a file or loaded through the classpath), one may create anInputStream
as often as is necessary. However, you should think of cases like an URL pointing to a servlet, where the resource contents change with every call.If you need a reliable way of reloading the resource more than once, then you should use
ResourceManager.getResourceAsFile(PlexusResource)
.- Specified by:
getInputStream
in interfacePlexusResource
- Returns:
- An
InputStream
with the resources contents, never null. - Throws:
IOException
-
getName
Description copied from interface:PlexusResource
Returns the resources name, if possible. A resources name is a relatively unspecified thing. For example, if the resource has anURL
, the name might be created by invokingURL.toExternalForm()
. In the case of aFile
, it might beFile.getPath()
.- Specified by:
getName
in interfacePlexusResource
-
getURI
Description copied from interface:PlexusResource
Returns the resources URI, if possible. A resource doesn't need to have an URI.
- Specified by:
getURI
in interfacePlexusResource
- Returns:
- The resources URI, if available, or null.
-
getURL
Description copied from interface:PlexusResource
Returns the resources URL, if possible. A resource doesn't need to have an URL.
- Specified by:
getURL
in interfacePlexusResource
- Returns:
- The resources URL, if available, or null.
- Throws:
IOException
-