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
FieldsModifier and TypeFieldDescriptionstatic final longUnknown modification datestatic final longUnknown resource size. -
Method Summary
Modifier and TypeMethodDescriptionCreates anInputStream, which may be used to read the files contents.longReturns the date, when the resource was last modified, if known.longgetSize()Returns the resources size, if known.getURL()Returns anURL, which may be used to reference the resource, if possible.booleanReturns, whether theFileInforefers to a directory.booleanReturns, whether the resource exists.booleanisFile()Returns, whether theFileInforefers to a file.Methods inherited from interface 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:
getSizein interfaceSizeSupplier
-
isFile
-
isDirectory
boolean isDirectory()Returns, whether theFileInforefers to a directory.- Specified by:
isDirectoryin 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:
getContentsin interfaceContentSupplier- Specified by:
getContentsin 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
-