FileInfo, ContentSupplier, FileSupplier, NameSupplier, ResourceAttributeSupplier, SizeSupplier, PlexusIoResourcePlexusIoSymlinkResourcepublic class PlexusIoFileResource extends AbstractPlexusIoResource implements ResourceAttributeSupplier, FileSupplier
PlexusIoResource for files.UNKNOWN_MODIFICATION_DATE, UNKNOWN_RESOURCE_SIZE| Modifier | Constructor | Description |
|---|---|---|
protected |
PlexusIoFileResource(java.io.File file,
java.lang.String name,
PlexusIoResourceAttributes attrs) |
| Modifier and Type | Method | Description |
|---|---|---|
PlexusIoResourceAttributes |
getAttributes() |
|
java.io.InputStream |
getContents() |
Creates an
InputStream, which may be used to read
the files contents. |
java.io.File |
getFile() |
Returns the resources file.
|
long |
getLastModified() |
Returns the date, when the resource was last modified, if known.
|
static java.lang.String |
getName(java.io.File file) |
|
long |
getSize() |
Returns the resources size, if known.
|
java.net.URL |
getURL() |
Returns an
URL, which may be used to reference the
resource, if possible. |
boolean |
isDirectory() |
Returns, whether the
FileInfo refers to a directory. |
boolean |
isExisting() |
Returns, whether the resource exists.
|
boolean |
isFile() |
Returns, whether the
FileInfo refers to a file. |
boolean |
isSymbolicLink() |
Returns, whether the
FileInfo refers to a symlink. |
getNameprotected PlexusIoFileResource(@Nonnull
java.io.File file,
@Nonnull
java.lang.String name,
@Nonnull
PlexusIoResourceAttributes attrs)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getName(java.io.File file)
@Nonnull public java.io.File getFile()
getFile in interface FileSupplier@Nonnull
public java.io.InputStream getContents()
throws java.io.IOException
PlexusIoResourceInputStream, 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+).getContents in interface ContentSuppliergetContents in interface FileInfogetContents in interface PlexusIoResourcejava.io.IOException@Nonnull
public java.net.URL getURL()
throws java.io.IOException
PlexusIoResourceURL, which may be used to reference the
resource, if possible.getURL in interface PlexusIoResourcePlexusIoResource.getContents().java.io.IOExceptionpublic long getSize()
PlexusIoResourcePlexusIoResource.UNKNOWN_RESOURCE_SIZE.getSize in interface PlexusIoResourcegetSize in interface SizeSuppliergetSize in class AbstractPlexusIoResourcepublic boolean isDirectory()
PlexusIoResourceFileInfo refers to a directory.isDirectory in interface FileInfoisDirectory in interface PlexusIoResourceisDirectory in class AbstractPlexusIoResourcepublic boolean isExisting()
PlexusIoResourceisExisting in interface PlexusIoResourceisExisting in class AbstractPlexusIoResourcepublic boolean isFile()
PlexusIoResourceFileInfo refers to a file.isFile in interface FileInfoisFile in interface PlexusIoResourceisFile in class AbstractPlexusIoResource@Nonnull public PlexusIoResourceAttributes getAttributes()
getAttributes in interface ResourceAttributeSupplierpublic long getLastModified()
PlexusIoResourcePlexusIoResource.UNKNOWN_MODIFICATION_DATE.getLastModified in interface PlexusIoResourcegetLastModified in class AbstractPlexusIoResourceFile.lastModified()public boolean isSymbolicLink()
FileInfoFileInfo refers to a symlink.
This does not necessarily mean that the underlying representation *is* a symlink on disk,
but that this resource represents a symlink.
This method will return "false" for java versions prior to java7.isSymbolicLink in interface FileInfoisSymbolicLink in class AbstractPlexusIoResource