public abstract class ReaderFactory extends Object
Reader.| Constructor and Description |
|---|
ReaderFactory(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.
|
| Modifier and Type | Method and Description |
|---|---|
abstract Reader |
create()
Creates a new
Reader for the file. |
Charset |
getCharset() |
abstract String |
getFileName()
Returns the name of the resource.
|
Document |
readDocument()
Parses the whole file into a
Document. |
Stream<String> |
readStream()
Provides the lines of the file as a
Stream of strings. |
String |
readString()
Reads the whole file into a
String. |
public ReaderFactory(@CheckForNull
Charset charset)
charset - the charset to use when reading the filepublic abstract String getFileName()
@MustBeClosed public abstract Reader create()
Reader for the file.@MustBeClosed public Stream<String> readStream()
Stream of strings.ParsingException - if the file could not be readpublic String readString()
String.ParsingException - if the file could not be readpublic Document readDocument()
Document.ParsingException - if the file could not be parsedpublic Charset getCharset()
Copyright © 2018. All rights reserved.