Class FileSource

java.lang.Object
org.apache.maven.building.FileSource
All Implemented Interfaces:
Source

public class FileSource extends Object implements Source
Wraps an ordinary File as a source.
  • Constructor Details

    • FileSource

      @Deprecated public FileSource(File file)
      Deprecated.
      Use FileSource(Path) instead.
      Creates a new source backed by the specified file.
      Parameters:
      file - The file, must not be null.
    • FileSource

      public FileSource(Path path)
      Creates a new source backed by the specified file.
      Parameters:
      path - The file, must not be null.
      Since:
      4.0.0
  • Method Details

    • 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 interface Source
      Returns:
      A byte stream to the source contents, never null.
      Throws:
      IOException - in case of IO issue
    • 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 interface Source
      Returns:
      A user-friendly hint about the location of the source, never null.
    • getFile

      @Deprecated public File getFile()
      Deprecated.
      Use getPath() instead.
      Gets the file of this source.
      Returns:
      The underlying file, never null.
    • getPath

      public Path getPath()
      Gets the file of this source.
      Returns:
      The underlying file, never null.
      Since:
      4.0.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object