public class Ini extends Object
| Constructor and Description |
|---|
Ini()
Creates an INI parser with the default configuration
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getCommentPrefixes() |
List<String> |
getDelimiters() |
List<String> |
getInlineCommentPrefixes() |
Map<String,Map<String,String>> |
getSections() |
String |
getValue(String sectionName,
String optionName) |
String |
getValue(String sectionName,
String optionName,
String fallback) |
boolean |
isAllowDuplicates() |
boolean |
isAllowInterpolation() |
boolean |
isAllowNoValue() |
boolean |
isEmptyLinesInValues() |
boolean |
isSpaceAroundDelimiters() |
Ini |
read(BufferedReader reader)
Parse INI text
|
Ini |
read(Path iniPath)
Parse an INI file with the default
Charset |
Ini |
read(Path iniPath,
Charset charset)
Parse an INI file with a specified
Charset |
Ini |
setAllowDuplicates(boolean allowDuplicates)
Set if duplicate sections and options will be accepted, or throw a
IniParserException at
read(BufferedReader) time. |
Ini |
setAllowInterpolation(boolean allowInterpolation)
Set if interpolation of values should be performed.
|
Ini |
setAllowNoValue(boolean allowNoValue)
Set if option keys with no values will be accepted, or throw a
IniParserException at
read(BufferedReader) time. |
Ini |
setCommentPrefixes(List<String> commentPrefixes)
Set which
Strings should start full comment lines. |
Ini |
setDelimiters(List<String> delimiters)
Set which
Strings should divide option keys from values |
Ini |
setEmptyLinesInValues(boolean emptyLinesInValues)
Set if empty lines should be considered to be a part of the latest option's value or not.
|
Ini |
setInlineCommentPrefixes(List<String> inlineCommentPrefixes)
Set which
Strings should divide data from comments on non-blank lines |
Ini |
setSpaceAroundDelimiters(boolean spaceAroundDelimiters)
Set if spaces should be placed around option key/value delimiters when writing
|
Ini |
write(BufferedWriter writer)
Write INI formatted text
|
Ini |
write(Path iniPath)
Write an INI file with the default
Charset |
Ini |
write(Path iniPath,
Charset charset)
Write an INI file with a specified
Charset |
public String getValue(String sectionName, String optionName) throws NoSectionError, NoOptionError
NoSectionErrorNoOptionErrorpublic String getValue(String sectionName, String optionName, String fallback) throws NoSectionError, NoOptionError
NoSectionErrorNoOptionErrorpublic boolean isAllowDuplicates()
public boolean isAllowInterpolation()
public boolean isAllowNoValue()
public boolean isEmptyLinesInValues()
public boolean isSpaceAroundDelimiters()
public Ini read(BufferedReader reader) throws IOException, IniParserException
reader - the BufferedReader to read the INI text fromIOException - When errors are encountered while reading from readerIniParserException - When the INI text read is invalid in some way.public Ini read(Path iniPath) throws IOException, IniParserException
CharsetiniPath - The Path pointing the the INI file to readIOException - When errors are encountered while reading from readerIniParserException - When the INI text read is invalid in some way.StandardCharsets.UTF_8public Ini read(Path iniPath, Charset charset) throws IOException, IniParserException
CharsetiniPath - The Path pointing the the INI file to readcharset - The Charset to use when reading the fileIOException - When errors are encountered while reading from readerIniParserException - When the INI text read is invalid in some way.StandardCharsetspublic Ini setAllowDuplicates(boolean allowDuplicates)
IniParserException at
read(BufferedReader) time.allowDuplicates - duplicates are accepted iff truepublic Ini setAllowInterpolation(boolean allowInterpolation)
IniParserException being thrown at
read(BufferedReader) time.allowInterpolation - values will be interpolated iff truepublic Ini setAllowNoValue(boolean allowNoValue)
IniParserException at
read(BufferedReader) time.allowNoValue - no value options are accepted iff truepublic Ini setCommentPrefixes(List<String> commentPrefixes)
Strings should start full comment lines.commentPrefixes - the full line comment prefixespublic Ini setDelimiters(List<String> delimiters)
Strings should divide option keys from valuesdelimiters - the key/value delimiterspublic Ini setEmptyLinesInValues(boolean emptyLinesInValues)
IniParserException to be thrown in some cases when falseemptyLinesInValues - empty lines are added to option values iff truepublic Ini setInlineCommentPrefixes(List<String> inlineCommentPrefixes)
Strings should divide data from comments on non-blank linesinlineCommentPrefixes - the partial line comment prefixespublic Ini setSpaceAroundDelimiters(boolean spaceAroundDelimiters)
spaceAroundDelimiters - place spaces around key/value delimiters iff truepublic Ini write(BufferedWriter writer) throws IOException
writer - the BufferedWriter to write the INI text toIOException - When errors are encountered while writing to the writerpublic Ini write(Path iniPath) throws IOException
CharsetiniPath - The Path pointing the the INI file to writeIOException - When errors are encountered while writing to the writerStandardCharsets.UTF_8public Ini write(Path iniPath, Charset charset) throws IOException
CharsetiniPath - The Path pointing the the INI file to writecharset - The Charset to use when writing the fileIOException - When errors are encountered while writing to the writerStandardCharsetsCopyright © 2016. All rights reserved.