Class FileReaderFactory

java.lang.Object
edu.hm.hafner.analysis.ReaderFactory
edu.hm.hafner.analysis.FileReaderFactory

public class FileReaderFactory extends ReaderFactory
Provides a ReaderFactory that returns readers for a given file.
Author:
Ullrich Hafner
  • Constructor Details

    • FileReaderFactory

      public FileReaderFactory(Path file, @CheckForNull Charset charset)
      Creates a new factory to read the specified file with a given charset.
      Parameters:
      file - the file to open
      charset - the charset to use when reading the file (or null if the charset should be detected)
    • FileReaderFactory

      public FileReaderFactory(Path file)
      Creates a new factory to read the specified file. The charset will be detected from xml header.
      Parameters:
      file - the file to open
  • Method Details

    • create

      @MustBeClosed public Reader create()
      Description copied from class: ReaderFactory
      Creates a new Reader for the file.
      Specified by:
      create in class ReaderFactory
      Returns:
      a reader
    • getFileName

      public String getFileName()
      Returns the absolute path of the resource. The file name uses UNIX path separators.
      Specified by:
      getFileName in class ReaderFactory
      Returns:
      the file name
    • getCharset

      public Charset getCharset()
      Description copied from class: ReaderFactory
      Returns the character set that is used to read the stream.
      Overrides:
      getCharset in class ReaderFactory
      Returns:
      the character set