public static class Tailer.Builder extends org.apache.commons.io.build.AbstractStreamBuilder<Tailer,Tailer.Builder>
Tailer
with default values.
For example:
Tailer t = Tailer.builder()
.setPath(path)
.setCharset(StandardCharsets.UTF_8)
.setDelayDuration(Duration.ofSeconds(1))
.setExecutorService(Executors.newSingleThreadExecutor(Builder::newDaemonThread))
.setReOpen(false)
.setStartThread(true)
.setTailable(tailable)
.setTailerListener(tailerListener)
.setTailFromEnd(false)
.get();
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
Tailer |
get()
Constructs a new instance.
|
Tailer.Builder |
setDelayDuration(java.time.Duration delayDuration)
Sets the delay duration.
|
Tailer.Builder |
setExecutorService(java.util.concurrent.ExecutorService executorService)
Sets the executor service to use when startThread is true.
|
Tailer.Builder |
setReOpen(boolean reOpen)
Sets the re-open behavior.
|
Tailer.Builder |
setStartThread(boolean startThread)
Sets the daemon thread startup behavior.
|
Tailer.Builder |
setTailable(Tailer.Tailable tailable)
Sets the tailable.
|
Tailer.Builder |
setTailerListener(TailerListener tailerListener)
Sets the listener.
|
Tailer.Builder |
setTailFromEnd(boolean end)
Sets the tail start behavior.
|
getCharset, setBufferSize, setBufferSize, setCharset, setCharset, setOpenOptions
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriter
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
public Tailer get()
This builder use the aspects tailable, Charset, TailerListener, delayDuration, end, reOpen, buffer size.
public Tailer.Builder setDelayDuration(java.time.Duration delayDuration)
delayDuration
- the delay between checks of the file for new content.public Tailer.Builder setExecutorService(java.util.concurrent.ExecutorService executorService)
executorService
- the executor service to use when startThread is true.public Tailer.Builder setReOpen(boolean reOpen)
reOpen
- whether to close/reopen the file between chunkspublic Tailer.Builder setStartThread(boolean startThread)
startThread
- whether to create a daemon thread automatically.public Tailer.Builder setTailable(Tailer.Tailable tailable)
tailable
- the tailable.public Tailer.Builder setTailerListener(TailerListener tailerListener)
tailerListener
- the listener.public Tailer.Builder setTailFromEnd(boolean end)
end
- Set to true to tail from the end of the file, false to tail from the beginning of the file.Copyright © 2010 - 2023 Adobe. All Rights Reserved