|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--AsciiDatabase.RCFile
Class for reading configuration files in the following format:
var1=value1
var2=value2
[header1]
var3=value3
var4=value4
[header2]
...
| Field Summary | |
private File |
file
|
private String |
lastproperty
|
private String |
line
|
private BufferedReader |
reader
|
private boolean |
repeatLine
|
| Constructor Summary | |
RCFile(File afile)
Opens the configuration file. |
|
| Method Summary | |
void |
close()
Close the configuration file. |
protected void |
finalize()
Close the configuration file. |
boolean |
FindHeader(String header)
Scan through the file (from the beginning) for a particular header. |
String |
FindNextHeader()
Reads lines from the file (starting at the current position) until a header is found. |
String |
LastProperty()
Returns the property name (name before equal sign) of the last value read with ReadNextCharValue(). |
String |
ReadCharValue(String field)
Searches for a specific value (property=value pair) at the beginning of the file (before the first header is found). |
String |
ReadCharValue(String field,
String header)
Searches for a specific value (property=value pair) under a particular header. |
private String |
readline()
Read a single line of the file. |
String |
ReadNextCharValue()
Searches the file for the next value (property=value pair). |
String |
ReadNextCharValue(String field)
Searches the file (starting at the current position) for a specific value (property=value pair). |
void |
ResetFile()
Reset to the beginning of the file. |
private void |
unreadline()
Push back the last line read so it can be read again. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private File file
private BufferedReader reader
private String line
private boolean repeatLine
private String lastproperty
| Constructor Detail |
public RCFile(File afile)
throws IOException
afile - configuration fileIOException - if there is an error reading from the file| Method Detail |
public void close()
protected void finalize()
finalize in class Object
public void ResetFile()
throws IOException
IOException - if there is an error reading from the file
private String readline()
throws IOException
IOException - if there is an error reading from the fileprivate void unreadline()
public String FindNextHeader()
throws IOException
IOException - if there is an error reading from the file
public boolean FindHeader(String header)
throws IOException
header - the particular header requiredIOException - if there is an error reading from the filepublic String LastProperty()
public String ReadNextCharValue()
throws IOException
IOException - if there is an error reading from the file
public String ReadNextCharValue(String field)
throws IOException
field - property name requiredIOException - if there is an error reading from the file
public String ReadCharValue(String field,
String header)
throws IOException
field - property requiredheader - section containing propertyIOException - if there is an error reading from the file
public String ReadCharValue(String field)
throws IOException
field - required propertyIOException - if there is an error reading from the file
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||