Interface PlexusIoResource
- All Superinterfaces:
ContentSupplier
,FileInfo
,NameSupplier
,SizeSupplier
- All Known Implementing Classes:
AbstractPlexusIoResource
,PlexusIoFileResource
,PlexusIoSymlinkResource
,PlexusIoURLResource
A resource is a file-like entity. It may be an actual file,
an URL, a zip entry, or something like that.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
Unknown modification datestatic final long
Unknown resource size. -
Method Summary
Modifier and TypeMethodDescriptionCreates anInputStream
, which may be used to read the files contents.long
Returns the date, when the resource was last modified, if known.long
getSize()
Returns the resources size, if known.getURL()
Returns anURL
, which may be used to reference the resource, if possible.boolean
Returns, whether theFileInfo
refers to a directory.boolean
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 Details
-
UNKNOWN_RESOURCE_SIZE
static final long UNKNOWN_RESOURCE_SIZEUnknown resource size.- See Also:
-
UNKNOWN_MODIFICATION_DATE
static final long UNKNOWN_MODIFICATION_DATEUnknown modification date- See Also:
-
-
Method Details
-
getLastModified
long getLastModified()Returns the date, when the resource was last modified, if known. Otherwise, returnsUNKNOWN_MODIFICATION_DATE
.- See Also:
-
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
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
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
-