public class LocalLineReader extends Object implements LineReader
Instances of this class are not safe for use by multiple threads.
LineReader.LineConsumer| Constructor and Description |
|---|
LocalLineReader()
Create a new local line reader.
|
LocalLineReader(String path)
Create a new local line reader.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
exists(String pathToTest)
Test whether the given file path exists.
|
ResultData |
readLines(LineReader.LineConsumer lineConsumer)
Read line by line until the current end.
|
void |
removePath()
Remove the current file path.
|
void |
setPath(String path)
Set the file path or null if you want to remove the current file path.
|
public LocalLineReader()
public LocalLineReader(String path)
path - The file pathpublic final void setPath(String path)
Resets the internal pointer to the last imported byte.
setPath in interface LineReaderpath - The file pathIllegalStateException - if this reader is already closedIllegalArgumentException - if the path is not null but blankpublic final void removePath()
removePath in interface LineReaderpublic final ResultData readLines(LineReader.LineConsumer lineConsumer)
Each call to this methods tries to continue reading after the last imported byte from the previous call.
The internal pointer to the last imported byte can and will be reseted by setting or removing the path.
The auto-connect flag is set to false.
readLines in interface LineReaderlineConsumer - The consumer which takes line by lineIllegalStateException - if this reader is already closedIllegalArgumentException - if the line consumer is nullIllegalArgumentException - if the path is null or emptypublic final boolean exists(String pathToTest)
exists in interface LineReaderpathToTest - The file pathIllegalStateException - if this reader is already closedIllegalArgumentException - if the path is null or blankpublic final void close()
close in interface Closeableclose in interface AutoCloseableclose in interface LineReaderCopyright © 2019. All rights reserved.