Package org.ini4j
Class ConfigParser
- Object
-
- org.ini4j.ConfigParser
-
- All Implemented Interfaces:
Serializable
public class ConfigParser extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfigParser.ConfigParserException
static class
ConfigParser.DuplicateSectionException
static class
ConfigParser.InterpolationException
static class
ConfigParser.InterpolationMissingOptionException
static class
ConfigParser.NoOptionException
static class
ConfigParser.NoSectionException
static class
ConfigParser.ParsingException
-
Constructor Summary
Constructors Constructor Description ConfigParser()
ConfigParser(Map<String,String> defaults)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSection(String section)
Map<String,String>
defaults()
String
get(String section, String option)
String
get(String section, String option, boolean raw)
String
get(String sectionName, String optionName, boolean raw, Map<String,String> variables)
boolean
getBoolean(String section, String option)
double
getDouble(String section, String option)
float
getFloat(String section, String option)
protected Ini
getIni()
int
getInt(String section, String option)
long
getLong(String section, String option)
boolean
hasOption(String sectionName, String optionName)
boolean
hasSection(String sectionName)
List<Map.Entry<String,String>>
items(String sectionName)
List<Map.Entry<String,String>>
items(String sectionName, boolean raw)
List<Map.Entry<String,String>>
items(String sectionName, boolean raw, Map<String,String> variables)
List<String>
options(String sectionName)
void
read(File file)
void
read(InputStream stream)
void
read(Reader reader)
void
read(String... filenames)
void
read(URL url)
boolean
removeOption(String sectionName, String optionName)
boolean
removeSection(String sectionName)
List<String>
sections()
void
set(String sectionName, String optionName, Object value)
void
write(File file)
void
write(OutputStream stream)
void
write(Writer writer)
-
-
-
Method Detail
-
getBoolean
public boolean getBoolean(String section, String option) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
getDouble
public double getDouble(String section, String option) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
getFloat
public float getFloat(String section, String option) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
getInt
public int getInt(String section, String option) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
getLong
public long getLong(String section, String option) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
addSection
public void addSection(String section) throws ConfigParser.DuplicateSectionException
-
defaults
public Map<String,String> defaults()
-
get
public String get(String section, String option) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
get
public String get(String section, String option, boolean raw) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
get
public String get(String sectionName, String optionName, boolean raw, Map<String,String> variables) throws ConfigParser.NoSectionException, ConfigParser.NoOptionException, ConfigParser.InterpolationException
-
hasOption
public boolean hasOption(String sectionName, String optionName)
-
hasSection
public boolean hasSection(String sectionName)
-
items
public List<Map.Entry<String,String>> items(String sectionName) throws ConfigParser.NoSectionException, ConfigParser.InterpolationMissingOptionException
-
items
public List<Map.Entry<String,String>> items(String sectionName, boolean raw) throws ConfigParser.NoSectionException, ConfigParser.InterpolationMissingOptionException
-
items
public List<Map.Entry<String,String>> items(String sectionName, boolean raw, Map<String,String> variables) throws ConfigParser.NoSectionException, ConfigParser.InterpolationMissingOptionException
-
options
public List<String> options(String sectionName) throws ConfigParser.NoSectionException
- Throws:
ConfigParser.NoSectionException
-
read
public void read(String... filenames) throws IOException, ConfigParser.ParsingException
- Throws:
IOException
ConfigParser.ParsingException
-
read
public void read(Reader reader) throws IOException, ConfigParser.ParsingException
- Throws:
IOException
ConfigParser.ParsingException
-
read
public void read(URL url) throws IOException, ConfigParser.ParsingException
- Throws:
IOException
ConfigParser.ParsingException
-
read
public void read(File file) throws IOException, ConfigParser.ParsingException
- Throws:
IOException
ConfigParser.ParsingException
-
read
public void read(InputStream stream) throws IOException, ConfigParser.ParsingException
- Throws:
IOException
ConfigParser.ParsingException
-
removeOption
public boolean removeOption(String sectionName, String optionName) throws ConfigParser.NoSectionException
- Throws:
ConfigParser.NoSectionException
-
removeSection
public boolean removeSection(String sectionName)
-
sections
public List<String> sections()
-
set
public void set(String sectionName, String optionName, Object value) throws ConfigParser.NoSectionException
- Throws:
ConfigParser.NoSectionException
-
write
public void write(Writer writer) throws IOException
- Throws:
IOException
-
write
public void write(OutputStream stream) throws IOException
- Throws:
IOException
-
write
public void write(File file) throws IOException
- Throws:
IOException
-
getIni
protected Ini getIni()
-
-