public class IniFile extends Object
Modifier and Type | Class and Description |
---|---|
static class |
IniFile.Section
Class representing one section of the ini file.
|
static class |
IniFile.SectionEntry |
static class |
IniFile.SectionEntryComment |
static class |
IniFile.SectionEntryKeyValue |
Modifier and Type | Field and Description |
---|---|
static Comparator<IniFile.SectionEntry> |
SECTION_ENTRY_INDEX_COMPARATOR |
static Comparator<IniFile.SectionEntry> |
SECTION_ENTRY_KEY_COMPARATOR |
Constructor and Description |
---|
IniFile()
Constructs Ini file with no defaults.
|
IniFile(File source)
Constructs GameBots2004Ini with defaults taken 'source' (file must exists!).
|
IniFile(IniFile ini) |
Modifier and Type | Method and Description |
---|---|
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'
|
public static final Comparator<IniFile.SectionEntry> SECTION_ENTRY_INDEX_COMPARATOR
public static final Comparator<IniFile.SectionEntry> SECTION_ENTRY_KEY_COMPARATOR
public IniFile()
public IniFile(File source)
source
- public IniFile(IniFile ini)
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 Collection<IniFile.Section> getSections()
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
- Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.