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 java.lang.Object implements Location
file location implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.channels.FileChannel
channel
private java.io.File
file
private java.lang.String
specification
private java.io.FileInputStream
stream
-
Constructor Summary
Constructors Modifier Constructor Description FileLocation(java.io.File file, java.lang.String specification)
protected
FileLocation(java.lang.String specification)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the location.java.io.File
getFile()
java.io.InputStream
getInputStream()
java.lang.String
getSpecification()
protected void
initFile()
initialize file.void
open()
open the location.int
read(byte[] buffer)
int
read(java.nio.ByteBuffer buffer)
protected void
setFile(java.io.File file)
protected java.io.File
unsafeGetFile()
-
-
-
Method Detail
-
getFile
public java.io.File getFile() throws java.io.IOException
-
unsafeGetFile
protected java.io.File unsafeGetFile()
- Returns:
File
-
initFile
protected void initFile() throws java.io.IOException
initialize file.- Throws:
java.io.IOException
- in case error.
-
setFile
protected void setFile(java.io.File file)
- Parameters:
file
-File
-
getSpecification
public java.lang.String getSpecification()
- Specified by:
getSpecification
in interfaceLocation
- Returns:
- spec.
-
open
public void open() throws java.io.IOException
open the location.
-
read
public int read(java.nio.ByteBuffer buffer) throws java.io.IOException
-
read
public int read(byte[] buffer) throws java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Specified by:
getInputStream
in interfaceLocation
- Returns:
- the resulting input stream.
- Throws:
java.io.IOException
- in case of an error.
-
-