public static class Tailer.Builder extends AbstractStreamBuilder<Tailer,Tailer.Builder>
Tailer.
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();
get()| Constructor and Description |
|---|
Builder()
Constructs a new builder of
Tailer. |
| Modifier and Type | Method and Description |
|---|---|
Tailer |
get()
Builds a new
Tailer. |
Tailer.Builder |
setDelayDuration(java.time.Duration delayDuration)
Sets the delay duration.
|
Tailer.Builder |
setExecutorService(ExecutorService executorService)
Sets the executor service to use when startThread is true.
|
Tailer.Builder |
setIgnoreTouch(boolean ignoreTouch)
Sets whether a change in timestamp causes the file to be re-read.
|
protected Tailer.Builder |
setOrigin(AbstractOrigin<?,?> origin)
Sets the origin.
|
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.
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionscheckOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriterasThisclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplier, getUncheckedpublic Builder()
Tailer.public Tailer get()
Tailer.
This builder uses the following aspects:
AbstractStreamBuilder.getBufferSize()AbstractStreamBuilder.getCharset()Tailer.TailableTailerListenerIOSupplier.getUnchecked()public Tailer.Builder setDelayDuration(java.time.Duration delayDuration)
delayDuration - the delay between checks of the file for new content.this instance.public Tailer.Builder setExecutorService(ExecutorService executorService)
executorService - the executor service to use when startThread is true.this instance.public Tailer.Builder setIgnoreTouch(boolean ignoreTouch)
Useful when your watched file gets touched (the timestamps is more recent without changing the file) or when a file system updates a timestamp before a file's content. The default (false) re-reads the current file, while true does nothing.
ignoreTouch - Whether a change in timestamp causes the file to be re-read.this instance.protected Tailer.Builder setOrigin(AbstractOrigin<?,?> origin)
setOrigin in class AbstractOriginSupplier<Tailer,Tailer.Builder>origin - the new origin.this instance.UnsupportedOperationException - if the origin cannot be converted to a Path.public Tailer.Builder setReOpen(boolean reOpen)
reOpen - whether to close/reopen the file between chunksthis instance.public Tailer.Builder setStartThread(boolean startThread)
startThread - whether to create a daemon thread automatically.this instance.public Tailer.Builder setTailable(Tailer.Tailable tailable)
tailable - the tailable.this instance.public Tailer.Builder setTailerListener(TailerListener tailerListener)
tailerListener - the listener.this instance.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.this instance.