java.lang.Object
java.io.InputStream
com.aoapps.hodgepodge.io.LogFollower
- All Implemented Interfaces:
Closeable
,AutoCloseable
Reads data as is it appended to a log file. If the log file
is closed and recreated, which is typical during log rotations,
the new file is opened and read from the beginning. The file is assumed
to have been replaced when its length is smaller than before.
This class will block on read. If end of file is reached, it will continue to block until data becomes available. End of file is never returned from this class, it will wait indefinitely for data.
- Author:
- AO Industries, Inc.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionLogFollower
(File file) LogFollower
(File file, int pollInterval) LogFollower
(String path) LogFollower
(String path, int pollInterval) -
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
Field Details
-
DEFAULT_POLL_INTERVAL
public static final int DEFAULT_POLL_INTERVAL- See Also:
-
-
Constructor Details
-
LogFollower
-
LogFollower
-
LogFollower
-
LogFollower
-
-
Method Details
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
getPollInterval
public int getPollInterval() -
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-