public class LocalLineWriter extends Object implements LineWriter
Instances of this class are not safe for use by multiple threads.
| Constructor and Description |
|---|
LocalLineWriter()
Create a new local line writer.
|
LocalLineWriter(String path)
Create a new local line writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
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.
|
ResultData |
writeLines(Supplier<String> lineSupplier)
Write line by line until the line supplier provides a null value.
|
public LocalLineWriter()
public LocalLineWriter(String path)
path - The file pathpublic final void setPath(String path)
setPath in interface LineWriterpath - The file pathIllegalStateException - if this writer is already closedIllegalArgumentException - if the path is not null but blankpublic final void removePath()
removePath in interface LineWriterpublic final ResultData writeLines(Supplier<String> lineSupplier)
Each call to this methods tries to continue writing after the last exported byte from the previous call.
The internal pointer to the last exported byte can and will be reseted by setting or removing the path.
The auto-connect flag is set to false.
writeLines in interface LineWriterlineSupplier - The supplier which provides line by line. A null value indicates the end.IllegalStateException - if this writer is already closedIllegalArgumentException - if the line supplier is nullIllegalArgumentException - if the path is null or emptypublic final void close()
close in interface Closeableclose in interface AutoCloseableclose in interface LineWriterCopyright © 2019. All rights reserved.