Class TailInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.carrotsearch.ant.tasks.junit4.TailInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
class TailInputStream extends java.io.InputStreamAn input stream that tails from a random access file as new input appears there. It's a lousy solution but we don't have access to real interprocess pipes from Java.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanclosedprivate java.io.RandomAccessFilerafprivate static longTAIL_CHECK_DELAYHow long to sleep (millis) before checking for updates?
-
Constructor Summary
Constructors Constructor Description TailInputStream(java.nio.file.Path file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanmarkSupported()intread()intread(byte[] b)intread(byte[] b, int off, int len)
-
-
-
Field Detail
-
TAIL_CHECK_DELAY
private static final long TAIL_CHECK_DELAY
How long to sleep (millis) before checking for updates?- See Also:
- Constant Field Values
-
raf
private java.io.RandomAccessFile raf
-
closed
private volatile boolean closed
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.InputStream
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
-