Package edu.hm.hafner.analysis
Class FileReaderFactory
- java.lang.Object
-
- edu.hm.hafner.analysis.ReaderFactory
-
- edu.hm.hafner.analysis.FileReaderFactory
-
public class FileReaderFactory extends ReaderFactory
Provides aReaderFactorythat returns readers for a given file.- Author:
- Ullrich Hafner
-
-
Constructor Summary
Constructors Constructor Description FileReaderFactory(Path file)Creates a new factory to read the specified file.FileReaderFactory(Path file, Charset charset)Creates a new factory to read the specified file with a given charset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Readercreate()Creates a newReaderfor the file.CharsetgetCharset()Returns the character set that is used to read the stream.StringgetFileName()Returns the absolute path of the resource.-
Methods inherited from class edu.hm.hafner.analysis.ReaderFactory
parse, readDocument, readStream, readString
-
-
-
-
Constructor Detail
-
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 opencharset- the charset to use when reading the file (ornullif 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 Detail
-
create
@MustBeClosed public Reader create()
Description copied from class:ReaderFactoryCreates a newReaderfor the file.- Specified by:
createin classReaderFactory- Returns:
- a reader
-
getFileName
public String getFileName()
Returns the absolute path of the resource. The file name uses UNIX path separators.- Specified by:
getFileNamein classReaderFactory- Returns:
- the file name
-
getCharset
public Charset getCharset()
Description copied from class:ReaderFactoryReturns the character set that is used to read the stream.- Overrides:
getCharsetin classReaderFactory- Returns:
- the character set
-
-