Package org.apache.maven.api.services
Interface Source
Provides access to the contents of a source independently of the
backing store (e.g. file system, database, memory).
This is mainly used to parse files into objects such as
Project
,
Model
,
Settings
, or
PersistedToolchains
.
- Since:
- 4.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionProvides a user-friendly hint about the location of the source.getPath()
Provides access the file to be parsed, if this source is backed by a file.Creates a new byte stream to the source contents.Returns a new source identified by a relative path.
-
Method Details
-
getPath
Provides access the file to be parsed, if this source is backed by a file.- Returns:
- the underlying
Path
, ornull
if this source is not backed by a file
-
openStream
Creates a new byte stream to the source contents. Closing the returned stream is the responsibility of the caller.- Returns:
- a byte stream to the source contents, never
null
- Throws:
IOException
- in case of IO issue
-
getLocation
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.- Returns:
- a user-friendly hint about the location of the source, never
null
-
resolve
Returns a new source identified by a relative path. Implementation MUST be able to acceptrelative
parameter values that- use either / or \ file path separator,
- have .. parent directory references,
- point either at file or directory.
- Parameters:
relative
- is the path of the requested source relative to this source- Returns:
- related source or
null
if no such source
-