Class FileDataSource

  • All Implemented Interfaces:
    Closeable, AutoCloseable, DataSource

    public class FileDataSource
    extends net.sourceforge.pmd.util.datasource.internal.AbstractDataSource
    DataSource implementation to read data from a file.
    • Constructor Detail

      • FileDataSource

        public FileDataSource​(File file)
        Parameters:
        file - the file to read
    • Method Detail

      • getInputStream

        public InputStream getInputStream()
                                   throws IOException
        Description copied from interface: DataSource
        Get an InputStream on the source file.
        Returns:
        the InputStream reading the source file
        Throws:
        IOException - if the file can't be opened
      • getNiceFileName

        public String getNiceFileName​(boolean shortNames,
                                      String inputPaths)
        Description copied from interface: DataSource
        Return a nice version of the filename.
        Parameters:
        shortNames - true if short names are being used
        inputPaths - name of a "master" file this file is relative to
        Returns:
        String
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object