ikrs.io.fileio.inifile
Class IniFile

java.lang.Object
  extended by ikrs.io.fileio.inifile.IniFile

public class IniFile
extends java.lang.Object

Ths IniFile has basic input/ouput method for reading and writing ini files. I needed this urgently so its functionality is very reduced. A future version should be configurable: - section format - key-value separator format - comment format


Constructor Summary
IniFile()
          Create a new default IniFile.
IniFile(java.util.Comparator<java.lang.String> keyComparator)
          Create a new IniFile with the given key comparator (for section names and key names both).
IniFile(EnvironmentFactory<java.lang.String,BasicType> environmentFactory)
          Create a new IniFile with the given environment factory.
 
Method Summary
static void main(java.lang.String[] argv)
          This is for testing purposes only.
 void read(java.io.BufferedReader reader, Environment<java.lang.String,BasicType> mainSection)
           
 Environment<java.lang.String,BasicType> read(java.io.File file)
           
 void read(java.io.File file, Environment<java.lang.String,BasicType> mainSection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IniFile

public IniFile()
Create a new default IniFile. The default implementation uses a case-insensitive key comparator and a default environment factory with a TreeMapFactory inside.


IniFile

public IniFile(java.util.Comparator<java.lang.String> keyComparator)
        throws java.lang.NullPointerException
Create a new IniFile with the given key comparator (for section names and key names both).

Parameters:
keyComparator - The key name (and section name) comparator; must not be null.
Throws:
java.lang.NullPointerException - If keyComparator is null.

IniFile

public IniFile(EnvironmentFactory<java.lang.String,BasicType> environmentFactory)
        throws java.lang.NullPointerException
Create a new IniFile with the given environment factory.

Parameters:
environmentFactory - The environment factory to use (must not be null).
Throws:
java.lang.NullPointerException - If environmentFactory is null.
Method Detail

read

public Environment<java.lang.String,BasicType> read(java.io.File file)
                                             throws java.io.IOException
Throws:
java.io.IOException

read

public void read(java.io.File file,
                 Environment<java.lang.String,BasicType> mainSection)
          throws java.io.IOException
Throws:
java.io.IOException

read

public void read(java.io.BufferedReader reader,
                 Environment<java.lang.String,BasicType> mainSection)
          throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] argv)
This is for testing purposes only.