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.InputStream
An 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 boolean
closed
private java.io.RandomAccessFile
raf
private static long
TAIL_CHECK_DELAY
How 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 void
close()
boolean
markSupported()
int
read()
int
read(byte[] b)
int
read(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:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-