Class ReaderDataSource

  • All Implemented Interfaces:
    Closeable, AutoCloseable, DataSource

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

      • ReaderDataSource

        public ReaderDataSource​(Reader reader,
                                String dataSourceName)
        Create the DataSource from the Reader.
    • Method Detail

      • getInputStream

        public InputStream getInputStream()
                                   throws IOException
        Convert the Reader into an InputStream.

        Note: This uses the default encoding.

        Returns:
        Derived InputStream
        Throws:
        IOException
      • getNiceFileName

        public String getNiceFileName​(boolean shortNames,
                                      String inputFileName)
        Return the dataSourceName via the DataSource Interface method.

        Both the parameters are ignored

        Parameters:
        shortNames - ignored
        inputFileName - ignored
        Returns:
      • getDataSourceName

        public String getDataSourceName()
        Returns:
        the dataSourceName
      • setDataSourceName

        public void setDataSourceName​(String dataSourceName)
        Parameters:
        dataSourceName - the dataSourceName to set