public class PlexusIoFileResource extends AbstractPlexusIoResource implements PlexusIoResourceWithAttributes
PlexusIoResource
for files.UNKNOWN_MODIFICATION_DATE, UNKNOWN_RESOURCE_SIZE
Constructor and Description |
---|
PlexusIoFileResource(File file,
PlexusIoResourceAttributes attrs) |
PlexusIoFileResource(File file,
String name,
PlexusIoResourceAttributes attrs) |
Modifier and Type | Method and Description |
---|---|
static PlexusIoFileResource |
fileOnDisk(File file,
String name,
PlexusIoResourceAttributes attrs) |
PlexusIoResourceAttributes |
getAttributes() |
InputStream |
getContents()
Creates an
InputStream , which may be used to read
the files contents. |
File |
getFile()
Returns the resources file.
|
long |
getLastModified()
Returns the date, when the resource was last modified, if known.
|
long |
getSize()
Returns the resources size, if known.
|
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. |
static PlexusIoFileResource |
justAFile(File file,
PlexusIoResourceAttributes attrs) |
getName
public PlexusIoFileResource(@Nonnull File file, @Nonnull PlexusIoResourceAttributes attrs)
public PlexusIoFileResource(@Nonnull File file, @Nonnull String name, @Nonnull PlexusIoResourceAttributes attrs)
public static PlexusIoFileResource fileOnDisk(File file, String name, PlexusIoResourceAttributes attrs)
public static PlexusIoFileResource justAFile(File file, @Nonnull PlexusIoResourceAttributes attrs)
@Nonnull public File getFile()
@Nonnull public InputStream getContents() throws IOException
PlexusIoResource
InputStream
, 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 FileInfo
getContents
in interface PlexusIoResource
IOException
@Nonnull public URL getURL() throws IOException
PlexusIoResource
URL
, which may be used to reference the
resource, if possible.getURL
in interface PlexusIoResource
PlexusIoResource.getContents()
.IOException
public long getSize()
PlexusIoResource
PlexusIoResource.UNKNOWN_RESOURCE_SIZE
.getSize
in interface PlexusIoResource
getSize
in class AbstractPlexusIoResource
public boolean isDirectory()
PlexusIoResource
FileInfo
refers to a directory.isDirectory
in interface FileInfo
isDirectory
in interface PlexusIoResource
isDirectory
in class AbstractPlexusIoResource
public boolean isExisting()
PlexusIoResource
isExisting
in interface PlexusIoResource
isExisting
in class AbstractPlexusIoResource
public boolean isFile()
PlexusIoResource
FileInfo
refers to a file.isFile
in interface FileInfo
isFile
in interface PlexusIoResource
isFile
in class AbstractPlexusIoResource
@Nonnull public PlexusIoResourceAttributes getAttributes()
getAttributes
in interface PlexusIoResourceWithAttributes
public long getLastModified()
PlexusIoResource
PlexusIoResource.UNKNOWN_MODIFICATION_DATE
.getLastModified
in interface PlexusIoResource
getLastModified
in class AbstractPlexusIoResource
File.lastModified()
public boolean isSymbolicLink()
FileInfo
FileInfo
refers to a symlink.
This method will return "false" for java versions prior to java7.isSymbolicLink
in interface FileInfo
isSymbolicLink
in class AbstractPlexusIoResource
Copyright © 2001-2014 Codehaus. All Rights Reserved.