public class CManagedFile
extends java.lang.Object
Every file has an associated bookmark file residing in the same directory. Classes using CManagedFile have control over the placement of bookmarks with respect to the content of the managed file.
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
m_bookmarkFile
This member represents the bookmark-file associated to the
managed file.
|
protected java.io.RandomAccessFile |
m_bookmarkStream
This member represents the input/output stream opened on the
bookmark file.
|
protected static int |
m_debugLevel |
protected java.io.File |
m_file
This member represents the file to be managed
|
protected ILogger |
m_iLogger
This member is used for reporting errors and warnings.
|
protected java.io.FileInputStream |
m_inputStream
This member represents the input stream opened on the managed file.
|
protected java.io.BufferedReader |
m_reader
This member represents the buffered reader to read characters from.
|
protected java.io.File |
m_scratchDir
This member is used for storing the scratch directory, where
bookmark files are kept.
|
Constructor and Description |
---|
CManagedFile(java.io.File file,
java.io.File scratchDir,
ILogger iLogger)
This constructor opens the specified file, checks if there is
an associated bookmark (checkpoint) file and if there is one,
retrieves the position to start reading from.
|
Modifier and Type | Method and Description |
---|---|
protected void |
debug(java.lang.String fName,
java.lang.String msg) |
protected void |
error(java.lang.String fName,
java.lang.String msg) |
static int |
getDebugLevel() |
java.io.File |
getFile() |
java.lang.String |
getFilename() |
char |
read() |
int |
read(char[] buf,
int len) |
java.lang.String |
readLine() |
boolean |
setBookmark(int lineNo)
This function is called to set a bookmark in the bookmark-file
associated to the managed file.
|
static void |
setDebugLevel(int debugLevel) |
protected static int m_debugLevel
protected java.io.File m_scratchDir
protected ILogger m_iLogger
protected java.io.File m_file
protected java.io.File m_bookmarkFile
protected java.io.FileInputStream m_inputStream
protected java.io.BufferedReader m_reader
protected java.io.RandomAccessFile m_bookmarkStream
public CManagedFile(java.io.File file, java.io.File scratchDir, ILogger iLogger) throws java.lang.Exception
java.lang.Exception
public static int getDebugLevel()
public java.io.File getFile()
public java.lang.String getFilename()
public char read() throws java.lang.Exception
java.lang.Exception
public java.lang.String readLine() throws java.lang.Exception
java.lang.Exception
public int read(char[] buf, int len) throws java.lang.Exception
java.lang.Exception
public boolean setBookmark(int lineNo)
public static void setDebugLevel(int debugLevel)
protected void error(java.lang.String fName, java.lang.String msg)
protected void debug(java.lang.String fName, java.lang.String msg)