Package org.apache.maven.building
Class FileSource
- java.lang.Object
-
- org.apache.maven.building.FileSource
-
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
FileModelSource
,FileSettingsSource
public class FileSource extends Object implements Source
Wraps an ordinaryFile
as a source.- Author:
- Benjamin Bentmann
-
-
Constructor Summary
Constructors Constructor Description FileSource(File file)
Creates a new source backed by the specified file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getFile()
Gets the file of this source.InputStream
getInputStream()
Gets a byte stream to the source contents.String
getLocation()
Provides a user-friendly hint about the location of the source.String
toString()
-
-
-
Constructor Detail
-
FileSource
public FileSource(File file)
Creates a new source backed by the specified file.- Parameters:
file
- The file, must not benull
.
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
Description copied from interface:Source
Gets a byte stream to the source contents. Closing the returned stream is the responsibility of the caller.- Specified by:
getInputStream
in interfaceSource
- Returns:
- A byte stream to the source contents, never
null
. - Throws:
IOException
-
getLocation
public String getLocation()
Description copied from interface:Source
Provides a user-friendly hint about the location of the source. This could be a local file path, a URI or just an empty string. The intention is to assist users during error reporting.- Specified by:
getLocation
in interfaceSource
- Returns:
- A user-friendly hint about the location of the source, never
null
.
-
getFile
public File getFile()
Gets the file of this source.- Returns:
- The underlying file, never
null
.
-
-