Interface Source
- All Known Subinterfaces:
- ModelSource
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 Maven projects, models, settings, or toolchains. The source implementation handles all the details of accessing the underlying content while providing a uniform API to consumers.
Sources can represent:
- Local filesystem files
- In-memory content
- Database entries
- Network resources
- Since:
- 4.0.0
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionReturns a human-readable description of where this source came from, used primarily for error messages and debugging.getPath()Provides access to the file backing this source, if available.Creates a new input stream to read the source contents.Resolves a new source relative to this one.
- 
Method Details- 
getPathProvides access to the file backing this source, if available. Not all sources are backed by files - for example, in-memory sources or database-backed sources will return null.- Returns:
- the underlying Pathif this source is file-backed, ornullif this source has no associated file
 
- 
openStreamCreates a new input stream to read the source contents. Each call creates a fresh stream starting from the beginning. The caller is responsible for closing the returned stream.- Returns:
- a new input stream positioned at the start of the content
- Throws:
- IOException- if the stream cannot be created or opened
 
- 
getLocationReturns a human-readable description of where this source came from, used primarily for error messages and debugging.Examples of locations: - Absolute file path: /path/to/pom.xml
- Relative file path: ../parent/pom.xml
- URL: https://repo.maven.org/.../pom.xml
- Description: <memory>or<database>
 - Returns:
- a non-null string describing the source location
 
- Absolute file path: 
- 
resolveResolves a new source relative to this one.The resolution strategy depends on the source type: - File sources resolve against their parent directory
- URL sources resolve against their base URL
- Other sources may not support resolution and return null
 The implementation must handle: - Both forward and back slashes as path separators
- Parent directory references (..)
- Both file and directory targets
 - Parameters:
- relative- path to resolve relative to this source
- Returns:
- the resolved source, or null if resolution not possible
- Throws:
- NullPointerException- if relative is null
 
 
-