Class FileResource
- java.lang.Object
-
- org.codehaus.commons.compiler.util.resource.FileResource
-
- All Implemented Interfaces:
LocatableResource,Resource
public class FileResource extends Object implements LocatableResource
Representation of a resource that is aFile.
-
-
Constructor Summary
Constructors Constructor Description FileResource(File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilegetFile()StringgetFileName()Returns a decorative "file name" that can be used for reporting errors and the like.URLgetLocation()longlastModified()Returns the time of the last modification, in milliseconds since 1970, or0Lif the time of the last modification cannot be determined.InputStreamopen()Opens the resource.StringtoString()
-
-
-
Constructor Detail
-
FileResource
public FileResource(File file)
-
-
Method Detail
-
getLocation
public URL getLocation() throws IOException
- Specified by:
getLocationin interfaceLocatableResource- Returns:
- A locator that addresses this resource's contents
- Throws:
IOException
-
getFileName
public final String getFileName()
Description copied from interface:ResourceReturns a decorative "file name" that can be used for reporting errors and the like. It does not necessarily map to a file in the local file system!- Specified by:
getFileNamein interfaceResource
-
open
public final InputStream open() throws IOException
Description copied from interface:ResourceOpens the resource. The caller is responsible for closing theInputStream.- Specified by:
openin interfaceResource- Throws:
IOException
-
lastModified
public final long lastModified()
Description copied from interface:ResourceReturns the time of the last modification, in milliseconds since 1970, or0Lif the time of the last modification cannot be determined.- Specified by:
lastModifiedin interfaceResource
-
getFile
public final File getFile()
- Returns:
- The file containing the contents of this resource
-
-