Interface PlexusIoResource
-
- All Superinterfaces:
ContentSupplier
,FileInfo
,NameSupplier
,SizeSupplier
- All Known Implementing Classes:
AbstractPlexusIoResource
,PlexusIoFileResource
,PlexusIoSymlinkResource
,PlexusIoURLResource
public interface PlexusIoResource extends FileInfo, SizeSupplier, ContentSupplier
A resource is a file-like entity. It may be an actual file, an URL, a zip entry, or something like that.
-
-
Field Summary
Fields Modifier and Type Field Description static long
UNKNOWN_MODIFICATION_DATE
Unknown modification datestatic long
UNKNOWN_RESOURCE_SIZE
Unknown resource size.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description InputStream
getContents()
Creates anInputStream
, which may be used to read the files contents.long
getLastModified()
Returns the date, when the resource was last modified, if known.long
getSize()
Returns the resources size, if known.URL
getURL()
Returns anURL
, which may be used to reference the resource, if possible.boolean
isDirectory()
Returns, whether theFileInfo
refers to a directory.boolean
isExisting()
Returns, whether the resource exists.boolean
isFile()
Returns, whether theFileInfo
refers to a file.-
Methods inherited from interface org.codehaus.plexus.components.io.fileselectors.FileInfo
getName, isSymbolicLink
-
-
-
-
Field Detail
-
UNKNOWN_RESOURCE_SIZE
static final long UNKNOWN_RESOURCE_SIZE
Unknown resource size.- See Also:
- Constant Field Values
-
UNKNOWN_MODIFICATION_DATE
static final long UNKNOWN_MODIFICATION_DATE
Unknown modification date- See Also:
- Constant Field Values
-
-
Method Detail
-
getLastModified
long getLastModified()
Returns the date, when the resource was last modified, if known. Otherwise, returnsUNKNOWN_MODIFICATION_DATE
.- See Also:
File.lastModified()
-
isExisting
boolean isExisting()
Returns, whether the resource exists.
-
getSize
long getSize()
Returns the resources size, if known. Otherwise returnsUNKNOWN_RESOURCE_SIZE
.- Specified by:
getSize
in interfaceSizeSupplier
-
isFile
boolean isFile()
Returns, whether theFileInfo
refers to a file.
-
isDirectory
boolean isDirectory()
Returns, whether theFileInfo
refers to a directory.- Specified by:
isDirectory
in interfaceFileInfo
-
getContents
@Nonnull InputStream getContents() throws IOException
Creates anInputStream
, which may be used to read the files contents. This is useful, if the file selector comes to a decision based on the files contents. Please note that this InputStream is unbuffered. Clients should wrap this in a BufferedInputStream or attempt reading reasonably large chunks (8K+).- Specified by:
getContents
in interfaceContentSupplier
- Specified by:
getContents
in interfaceFileInfo
- Throws:
IOException
-
getURL
URL getURL() throws IOException
Returns anURL
, which may be used to reference the resource, if possible.- Returns:
- An URL referencing the resource, if possible, or null.
In the latter case, you are forced to use
getContents()
. - Throws:
IOException
-
-