|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.utils.IniFile
public class IniFile
Nested Class Summary | |
---|---|
static class |
IniFile.Section
Class representing one section of the ini file. |
static class |
IniFile.SectionEntry
|
static class |
IniFile.SectionEntryComment
|
static class |
IniFile.SectionEntryKeyValue
|
Field Summary | |
---|---|
static Comparator<IniFile.SectionEntry> |
SECTION_ENTRY_INDEX_COMPARATOR
|
static Comparator<IniFile.SectionEntry> |
SECTION_ENTRY_KEY_COMPARATOR
|
Constructor Summary | |
---|---|
IniFile()
Constructs Ini file with no defaults. |
|
IniFile(File source)
Constructs GameBots2004Ini with defaults taken 'source' (file must exists!). |
|
IniFile(IniFile ini)
|
Method Summary | |
---|---|
IniFile |
addIniFile(IniFile iniFile)
Add all sections from one ini file into this one. |
IniFile.Section |
addSection(IniFile.Section section)
Adds section into this ini file. |
IniFile.Section |
addSection(String sectionName)
Adds a new section into this class (won't overwrite existing one). |
IniFile.Section |
copySection(IniFile.Section section)
|
String |
get(String section,
String key)
|
IniFile.Section |
getSection(String name)
|
Set<String> |
getSectionNames()
|
Collection<IniFile.Section> |
getSections()
|
static boolean |
hasCommentKey(String comment)
Whether this comment is commented key=value pair. |
static boolean |
hasKey(String keyValue)
Whether this non-comment line is a key=value. |
boolean |
hasSection(String name)
|
static boolean |
isComment(String line)
Whether this line is comment. |
void |
load(File source)
Loads IniFile#source into sections . |
void |
load(InputStream source)
Loads IniFile#source into sections . |
static void |
mergeIntoIniFile(IniFile values,
File mergeIntoIniFile)
|
String |
output()
Returns contents of this IniFile as string. |
void |
output(File file)
Outputs GameBots2004.ini stored by this class into 'file'. |
void |
output(PrintWriter writer)
Outputs contents of this IniFile into the 'writer'. |
void |
output(String pathToFileToBeCreated)
Outputs GameBots2004.ini stored by this class into 'file'. |
IniFile.Section |
set(IniFile.Section section)
Set key=values from 'section' into this IniFile. |
IniFile |
set(IniFile values)
Set 'values' into this IniFile, alias for addIniFile(IniFile) . |
IniFile.Section |
set(String section,
String key,
String value)
Sets property key=value into section 'section' |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Comparator<IniFile.SectionEntry> SECTION_ENTRY_INDEX_COMPARATOR
public static final Comparator<IniFile.SectionEntry> SECTION_ENTRY_KEY_COMPARATOR
Constructor Detail |
---|
public IniFile()
public IniFile(File source)
source
- public IniFile(IniFile ini)
Method Detail |
---|
public void load(File source)
IniFile#source
into sections
.
Note that his method won't clear anything, it will just load all sections/properties from the given file possibly overwriting existing properties in existing sections.
source
- public void load(InputStream source)
IniFile#source
into sections
.
Note that his method won't clear anything, it will just load all sections/properties from the given file possibly overwriting existing properties in existing sections.
source
- public IniFile addIniFile(IniFile iniFile)
iniFile
-
public IniFile.Section addSection(String sectionName)
sectionName
-
public IniFile.Section addSection(IniFile.Section section)
If 'section' is a new section (i.e., its IniFile.Section.getName()
is not already present in stored sections), this instance
will be stored here (does not hard-copy the section!). For hard-copy variant, use copySection(Section)
.
section
-
public IniFile.Section copySection(IniFile.Section section)
public boolean hasSection(String name)
public IniFile.Section getSection(String name)
public Set<String> getSectionNames()
public Collection<IniFile.Section> getSections()
public String get(String section, String key)
public IniFile.Section set(String section, String key, String value)
section
- key
- value
-
public IniFile set(IniFile values)
addIniFile(IniFile)
.
values
-
public IniFile.Section set(IniFile.Section section)
addSection(Section)
.
section
-
public static boolean isComment(String line)
text
-
public static boolean hasKey(String keyValue)
keyValue
-
public static boolean hasCommentKey(String comment)
comment
-
public void output(String pathToFileToBeCreated)
file
- public void output(File file)
file
- public void output(PrintWriter writer)
IniFile
into the 'writer'.
writer
- public String output()
IniFile
as string.
public static void mergeIntoIniFile(IniFile values, File mergeIntoIniFile)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |