java.lang.Object
edu.hm.hafner.analysis.ReaderFactory
- Bekannte direkte Unterklassen:
FileReaderFactory
Provides several useful helper methods to read the contents of a resource that is given by a
Reader.- Autor:
- Ullrich Hafner
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungReaderFactory(Charset charset) Creates a new factory to read a resource with a given charset.ReaderFactory(Charset charset, Function<String, String> lineMapper) Creates a new factory to read a resource with a given charset. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungabstract Readercreate()Creates a newReaderfor the file.Returns the character set that is used to read the stream.abstract StringReturns the name of the resource.voidparse(DefaultHandler handler) Parses the whole file with the specified SAXDefaultHandler.Parses the whole file into aDocument.Provides the lines of the file as aStreamof strings.Reads the whole file into aString.
-
Konstruktordetails
-
ReaderFactory
Creates a new factory to read a resource with a given charset.- Parameter:
charset- the charset to use when reading the file
-
ReaderFactory
Creates a new factory to read a resource with a given charset.- Parameter:
charset- the charset to use when reading the filelineMapper- provides a mapper to transform each of the resource lines
-
-
Methodendetails
-
getFileName
Returns the name of the resource.- Gibt zurück:
- the file name
-
create
Creates a newReaderfor the file.- Gibt zurück:
- a reader
-
readStream
Provides the lines of the file as aStreamof strings.- Gibt zurück:
- the file content as stream
- Löst aus:
ParsingException- if the file could not be read
-
readString
Reads the whole file into aString.- Gibt zurück:
- the file content as string
- Löst aus:
ParsingException- if the file could not be read
-
readDocument
Parses the whole file into aDocument.- Gibt zurück:
- the file content as document
- Löst aus:
ParsingException- if the file could not be parsed
-
getCharset
Returns the character set that is used to read the stream.- Gibt zurück:
- the character set
-
parse
Parses the whole file with the specified SAXDefaultHandler.- Parameter:
handler- the SAX handler to parse the file- Löst aus:
ParsingException- if the file could not be parsed
-