Class FilePlexusResource
- java.lang.Object
-
- org.codehaus.plexus.resource.loader.FilePlexusResource
-
- All Implemented Interfaces:
PlexusResource
public class FilePlexusResource extends java.lang.Object implements PlexusResource
Implementation ofPlexusResourcefor files.
-
-
Constructor Summary
Constructors Constructor Description FilePlexusResource(java.io.File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilegetFile()Returns the resource as a file, if possible.java.io.InputStreamgetInputStream()Returns the resource as anInputStream.java.lang.StringgetName()Returns the resources name, if possible.java.net.URIgetURI()Returns the resources URI, if possible.java.net.URLgetURL()Returns the resources URL, if possible.
-
-
-
Method Detail
-
getFile
public java.io.File getFile()
Description copied from interface:PlexusResourceReturns 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:
getFilein interfacePlexusResource- Returns:
- A
Filecontaining the resources contents, if available, or null.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionDescription copied from interface:PlexusResourceReturns 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 anInputStreamas 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:
getInputStreamin interfacePlexusResource- Returns:
- An
InputStreamwith the resources contents, never null. - Throws:
java.io.IOException
-
getName
public java.lang.String getName()
Description copied from interface:PlexusResourceReturns 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:
getNamein interfacePlexusResource
-
getURI
public java.net.URI getURI()
Description copied from interface:PlexusResourceReturns the resources URI, if possible. A resource doesn't need to have an URI.
- Specified by:
getURIin interfacePlexusResource- Returns:
- The resources URI, if available, or null.
-
getURL
public java.net.URL getURL() throws java.io.IOExceptionDescription copied from interface:PlexusResourceReturns the resources URL, if possible. A resource doesn't need to have an URL.
- Specified by:
getURLin interfacePlexusResource- Returns:
- The resources URL, if available, or null.
- Throws:
java.io.IOException
-
-