org.apache.maven.shared.io.location

## Class FileLocation

- java.lang.Object
- - org.apache.maven.shared.io.location.FileLocation

All Implemented Interfaces:
  Location

Direct Known Subclasses:
  ArtifactLocation, URLLocation

    public class FileLocation
    extends Object
    implements Location

file location implementation.

### Constructor Summary

Constructors
`` `FileLocation(File file, String specification)`
`protected` `FileLocation(String specification)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Close the location.
`File` `getFile()`
`InputStream` `getInputStream()`
`String` `getSpecification()`
`protected void` `initFile()` initialize file.
`void` `open()` open the location.
`int` `read(byte[] buffer)`
`int` `read(ByteBuffer buffer)`
`protected void` `setFile(File file)`
`protected File` `unsafeGetFile()`

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

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

### Constructor Detail

#### FileLocation

    public FileLocation(File file,
                        String specification)

Parameters:
  `file` - `File`
  `specification` - spec.

#### FileLocation

    protected FileLocation(String specification)

Parameters:
  `specification` - spec.

### Method Detail

#### close

    public void close()

Close the location.

Specified by:
  `close` in interface `Location`

#### getFile

    public File getFile()
                 throws IOException

Specified by:
  `getFile` in interface `Location`
Returns:
  `File`.
Throws:
  `IOException` - in case of an error.

#### unsafeGetFile

    protected File unsafeGetFile()

Returns:
  `File`

#### initFile

    protected void initFile()
                     throws IOException

initialize file.

Throws:
  `IOException` - in case error.

#### setFile

    protected void setFile(File file)

Parameters:
  `file` - `File`

#### getSpecification

    public String getSpecification()

Specified by:
  `getSpecification` in interface `Location`
Returns:
  spec.

#### open

    public void open()
              throws IOException

open the location.

Specified by:
  `open` in interface `Location`
Throws:
  `IOException` - in case of an error.

#### read

    public int read(ByteBuffer buffer)
             throws IOException

Specified by:
  `read` in interface `Location`
Parameters:
  `buffer` - The buffer.
Returns:
  number of read bytes.
Throws:
  `IOException` - in case of an error.

#### read

    public int read(byte[] buffer)
             throws IOException

Specified by:
  `read` in interface `Location`
Parameters:
  `buffer` - The buffer.
Returns:
  number of read bytes.
Throws:
  `IOException` - in case of an error.

#### getInputStream

    public InputStream getInputStream()
                               throws IOException

Specified by:
  `getInputStream` in interface `Location`
Returns:
  the resulting input stream.
Throws:
  `IOException` - in case of an error.