public class NewlogFetcher
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEBUG_BISECT |
static int |
DEBUG_INIT |
static int |
DEBUG_LINE |
static int |
DEBUG_LOCATE |
static int |
DEBUG_NEWLOG |
static int |
DEBUG_SAVE |
static int |
DEBUG_SCAN |
static int |
DEBUG_TIME |
java.util.List<java.lang.String> |
logBuffer |
static int |
MAXLOGLENGTH |
static int |
MAXNUMBERLOGS |
static long |
YEARMILLIS |
Constructor and Description |
---|
NewlogFetcher(java.util.Map props) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.lang.String |
getLine()
It returns a line as a String read from the input.
|
java.util.List<java.lang.String> |
getNewlogs()
It opens the log file and locates the first new entry according to
the reference info, reads the all log entries from the location line
by line up to the end of the logfile or until the buffer is full.
|
long |
getOffset() |
java.lang.String |
getPath() |
long |
getPosition() |
long |
getTimestamp() |
long |
getTimestamp(java.lang.String line)
returns the timestamp in msec for the log entry or -1L otherwise
|
long |
locateNewlog()
It locates the first new log entry according to the reference info of
the logfile and returns the position of the EOF or new log entry.
|
void |
saveReference()
It flushes the current reference info to a given file for log tracking
only if the SaveReference is enabled.
|
void |
saveReference(long position,
long timestamp,
long offset)
It flushes the specified reference info to the reference file for log
tracking no matter the SaveReference is enabled or not.
|
void |
seek(long pos) |
void |
setReference(long position,
long timestamp,
long offset)
It sets the current reference info.
|
void |
updateReference(long offset) |
void |
updateReference(long position,
long timestamp,
long offset)
It updates the current reference info.
|
public java.util.List<java.lang.String> logBuffer
public static final int MAXNUMBERLOGS
public static final int MAXLOGLENGTH
public static final long YEARMILLIS
public static final int DEBUG_INIT
public static final int DEBUG_LOCATE
public static final int DEBUG_BISECT
public static final int DEBUG_SCAN
public static final int DEBUG_SAVE
public static final int DEBUG_LINE
public static final int DEBUG_TIME
public static final int DEBUG_NEWLOG
public long locateNewlog() throws java.io.IOException
java.io.IOException
public java.util.List<java.lang.String> getNewlogs() throws java.io.IOException
java.io.IOException
public void setReference(long position, long timestamp, long offset)
public void updateReference(long position, long timestamp, long offset)
public void updateReference(long offset)
public void saveReference() throws java.io.IOException
java.io.IOException
public void saveReference(long position, long timestamp, long offset) throws java.io.IOException
java.io.IOException
public long getTimestamp(java.lang.String line)
public long getTimestamp()
public long getPosition()
public long getOffset()
public java.lang.String getPath()
public java.lang.String getLine() throws java.io.IOException
java.io.IOException
public void seek(long pos) throws java.io.IOException
java.io.IOException
public void close()