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 longUNKNOWN_MODIFICATION_DATEUnknown modification datestatic longUNKNOWN_RESOURCE_SIZEUnknown resource size.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description InputStreamgetContents()Creates anInputStream, which may be used to read the files contents.longgetLastModified()Returns the date, when the resource was last modified, if known.longgetSize()Returns the resources size, if known.URLgetURL()Returns anURL, which may be used to reference the resource, if possible.booleanisDirectory()Returns, whether theFileInforefers to a directory.booleanisExisting()Returns, whether the resource exists.booleanisFile()Returns, whether theFileInforefers 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:
getSizein interfaceSizeSupplier
-
isFile
boolean isFile()
Returns, whether theFileInforefers to a file.
-
isDirectory
boolean isDirectory()
Returns, whether theFileInforefers to a directory.- Specified by:
isDirectoryin 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:
getContentsin interfaceContentSupplier- Specified by:
getContentsin 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
-
-