Package org.apache.commons.io.input
Class Tailer.Builder
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<Tailer,Tailer.Builder>
 
org.apache.commons.io.build.AbstractOriginSupplier<Tailer,Tailer.Builder>
 
org.apache.commons.io.build.AbstractStreamBuilder<Tailer,Tailer.Builder>
 
org.apache.commons.io.input.Tailer.Builder
- All Implemented Interfaces:
- IOSupplier<Tailer>
- Enclosing class:
- Tailer
Builds a new 
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();
 - Since:
- 2.12.0
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionget()Builds a newTailer.setDelayDuration(Duration delayDuration) Sets the delay duration. null resets to the default delay of one second.setExecutorService(ExecutorService executorService) Sets the executor service to use when startThread is true.setIgnoreTouch(boolean ignoreTouch) Sets whether a change in timestamp causes the file to be re-read.protected Tailer.BuildersetOrigin(AbstractOrigin<?, ?> origin) Sets the origin.setReOpen(boolean reOpen) Sets the re-open behavior.setStartThread(boolean startThread) Sets the daemon thread startup behavior.setTailable(Tailer.Tailable tailable) Sets the tailable.setTailerListener(TailerListener tailerListener) Sets the listener.setTailFromEnd(boolean end) Sets the tail start behavior.Methods inherited from class org.apache.commons.io.build.AbstractStreamBuildergetBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionsMethods inherited from class org.apache.commons.io.build.AbstractOriginSuppliercheckOrigin, 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, setWriterMethods inherited from class org.apache.commons.io.build.AbstractSupplierasThisMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.io.function.IOSupplierasSupplier, getUnchecked
- 
Constructor Details
- 
Method Details- 
getBuilds a newTailer.This builder uses the following aspects: - AbstractStreamBuilder.getBufferSize()
- AbstractStreamBuilder.getCharset()
- Tailer.Tailable
- TailerListener
- delayDuration
- tailFromEnd
- reOpen
 - Returns:
- a new instance.
- See Also:
 
- 
setDelayDurationSets the delay duration. null resets to the default delay of one second.- Parameters:
- delayDuration- the delay between checks of the file for new content.
- Returns:
- thisinstance.
 
- 
setExecutorServiceSets the executor service to use when startThread is true.- Parameters:
- executorService- the executor service to use when startThread is true.
- Returns:
- thisinstance.
 
- 
setIgnoreTouchSets whether a change in timestamp causes the file to be re-read.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. - Parameters:
- ignoreTouch- Whether a change in timestamp causes the file to be re-read.
- Returns:
- thisinstance.
- Since:
- 2.20.0
 
- 
setOriginSets the origin.- Overrides:
- setOriginin class- AbstractOriginSupplier<Tailer,- Tailer.Builder> 
- Parameters:
- origin- the new origin.
- Returns:
- thisinstance.
- Throws:
- UnsupportedOperationException- if the origin cannot be converted to a Path.
 
- 
setReOpenSets the re-open behavior.- Parameters:
- reOpen- whether to close/reopen the file between chunks
- Returns:
- thisinstance.
 
- 
setStartThreadSets the daemon thread startup behavior.- Parameters:
- startThread- whether to create a daemon thread automatically.
- Returns:
- thisinstance.
 
- 
setTailableSets the tailable.- Parameters:
- tailable- the tailable.
- Returns:
- thisinstance.
 
- 
setTailerListenerSets the listener.- Parameters:
- tailerListener- the listener.
- Returns:
- thisinstance.
 
- 
setTailFromEndSets the tail start behavior.- Parameters:
- end- Set to true to tail from the end of the file, false to tail from the beginning of the file.
- Returns:
- thisinstance.
 
 
-