Package org.codehaus.commons.compiler.util.resource

# 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 a `File`.

## Constructor Summary

Constructors
Constructor
Description
`FileResource(File file)`

## Method Summary

Modifier and Type
Method
Description
`final File`
`getFile()`
`final String`
`getFileName()`
Returns a decorative "file name" that can be used for reporting errors and the like.
`URL`
`getLocation()`
`final long`
`lastModified()`
Returns the time of the last modification, in milliseconds since 1970, or `0L` if the time of the last modification cannot be determined.
`final InputStream`
`open()`
Opens the resource.
`final String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### FileResource

public FileResource(File file)

## Method Details

### getLocation

public URL getLocation() throws IOException

Specified by:
  `getLocation` in interface `LocatableResource`
Returns:
  A locator that addresses this resource's contents
Throws:
  `IOException`

### getFileName

public final String getFileName()
Description copied from interface: `Resource`
Returns 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:
  `getFileName` in interface `Resource`

### open

public final InputStream open() throws IOException
Description copied from interface: `Resource`
Opens the resource. The caller is responsible for closing the `InputStream`.

Specified by:
  `open` in interface `Resource`
Throws:
  `IOException`

### lastModified

public final long lastModified()
Description copied from interface: `Resource`
Returns the time of the last modification, in milliseconds since 1970, or `0L` if the time of the last modification cannot be determined.

Specified by:
  `lastModified` in interface `Resource`

### getFile

public final File getFile()

Returns:
  The file containing the contents of this resource

### toString

public final String toString()

Overrides:
  `toString` in class `Object`