|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
org.jwall.log.io.SequentialFileInputStream
public class SequentialFileInputStream
This class implements an input stream that will read from a sequence of files. It is intended to provide the opposite of a split of files into parts. Each part is read in chronological order.
At the end, the stream waits for new data to be appended to the last file, or a new file to be created that matches the names.
| Constructor Summary | |
|---|---|
SequentialFileInputStream(File file)
Creates a new SequentialInputStream, which will read the specified file and any subsequent files that match the file's name, possibly and a appended number, i.e. for the file /tmp/test.log the stream will read
/tmp/test.log
/tmp/test.log.1
/tmp/test.log.2
... |
|
SequentialFileInputStream(File file,
boolean removeAfterRead)
This creates a SequentialInputStream which will remove any files that have completeley been read (i.e. they have been processed until EOF and another, newer file matching the pattern does exist). |
|
SequentialFileInputStream(File file,
String pattern,
boolean removeAfterRead)
|
|
| Method Summary | |
|---|---|
int |
available()
|
static void |
main(String[] args)
|
boolean |
markSupported()
|
boolean |
matchesSequence(File f)
|
int |
read()
This read method is basically a read of the current open file. |
| Methods inherited from class java.io.InputStream |
|---|
close, mark, read, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SequentialFileInputStream(File file)
throws IOException
/tmp/test.log the stream will read
/tmp/test.log
/tmp/test.log.1
/tmp/test.log.2
...
The trailing digits may as well be time-stamps or the like. The files are
read in order of their last-modification-time.
file - The initial file.
IOException
public SequentialFileInputStream(File file,
boolean removeAfterRead)
throws IOException
This creates a SequentialInputStream which will remove any files that have completeley been read (i.e. they have been processed until EOF and another, newer file matching the pattern does exist).
Whether the old files are to be removed is determined by the removeAfterRead
flag.
file - The initial file to start with.removeAfterRead - Whether the old files should be removed or not.
IOException
public SequentialFileInputStream(File file,
String pattern,
boolean removeAfterRead)
throws IOException
IOException| Method Detail |
|---|
public boolean matchesSequence(File f)
public int read()
throws IOException
This read method is basically a read of the current open file. It will block if there is no more data and no new file exists.
read in class InputStreamIOExceptionInputStream.read()public boolean markSupported()
markSupported in class InputStreamInputStream.markSupported()
public int available()
throws IOException
available in class InputStreamIOExceptionInputStream.available()
public static void main(String[] args)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||