org.jagatoo.util.ini
Class IniWriter

java.lang.Object
  extended by org.jagatoo.util.ini.IniWriter

public class IniWriter
extends java.lang.Object

The IniWriter writes ini files ;).


Constructor Summary
IniWriter(java.io.File file)
           
IniWriter(java.io.OutputStream out)
           
IniWriter(java.lang.String filename)
           
IniWriter(java.io.Writer writer)
           
 
Method Summary
 void close()
          Flushes and closes the file.
 int getMinCommentPosition()
          Gets setting "minCommentPosition".
 int getMinEqualSignPosition()
          Gets setting "minEqualSignPosition".
 int getMinValuePosition()
          Gets setting "minValuePosition".
 boolean getPutSpacesAroundEqualSign()
          Gets setting "putSpacesAroundEqualSign".
 int getSettingIndentSpaces()
          Gets the number of spaces to indent settings by.
 boolean getSpaceGroup()
          Gets setting "spaceGroup".
 void setMinCommentPosition(int minPos)
          Configures the writer to put as many spaces before the comment, so that it is placed at least at the given column.
 void setMinEqualSignPosition(int minPos)
          Configures the writer to put as many spaces before the equals sign, so that it is placed at least at the given column.
 void setMinValuePosition(int minPos)
          Configures the writer to put as many spaces before the value, so that it is placed at least at the given column.
 void setPutSpacesAroundEqualSign(boolean b)
          Configures the writer to put a spaces before and after the equal sign of a setting.
 void setSettingIndentSpaces(int numSpaces)
          Sets the number of spaces to indent settings by.
 void setSpaceGroup(boolean b)
          Configures the writer to put a spaces before and after the group name (between the brackets).
 void writeComment(java.lang.String comment)
          Writes a new (standalone) comment to the file.
 void writeEmptyLine()
          Writes an empty line to the file.
 void writeGroup(java.lang.String group)
          Writes a new Group to the file.
 void writeSetting(java.lang.String key, java.lang.Object value)
          Writes a new setting to the next line.
 void writeSetting(java.lang.String key, java.lang.Object value, java.lang.String comment)
          Writes a new setting to the next line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IniWriter

public IniWriter(java.io.Writer writer)

IniWriter

public IniWriter(java.io.OutputStream out)

IniWriter

public IniWriter(java.io.File file)
          throws java.io.IOException
Throws:
java.io.IOException

IniWriter

public IniWriter(java.lang.String filename)
          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

setSettingIndentSpaces

public void setSettingIndentSpaces(int numSpaces)
Sets the number of spaces to indent settings by.

Parameters:
numSpaces -

getSettingIndentSpaces

public final int getSettingIndentSpaces()
Gets the number of spaces to indent settings by.

Returns:
the number of spaces to indent settings by.

setSpaceGroup

public void setSpaceGroup(boolean b)
Configures the writer to put a spaces before and after the group name (between the brackets).

Parameters:
b -

getSpaceGroup

public final boolean getSpaceGroup()
Gets setting "spaceGroup".

Returns:
setting "spaceGroup".

setPutSpacesAroundEqualSign

public void setPutSpacesAroundEqualSign(boolean b)
Configures the writer to put a spaces before and after the equal sign of a setting.

Parameters:
b -

getPutSpacesAroundEqualSign

public final boolean getPutSpacesAroundEqualSign()
Gets setting "putSpacesAroundEqualSign".

Returns:
setting "putSpacesAroundEqualSign".

setMinEqualSignPosition

public void setMinEqualSignPosition(int minPos)
Configures the writer to put as many spaces before the equals sign, so that it is placed at least at the given column.

Parameters:
minPos - (Use negative values for no specific rule.)

getMinEqualSignPosition

public final int getMinEqualSignPosition()
Gets setting "minEqualSignPosition".

Returns:
setting "minEqualSignPosition".

setMinValuePosition

public void setMinValuePosition(int minPos)
Configures the writer to put as many spaces before the value, so that it is placed at least at the given column.

Parameters:
minPos - (Use negative values for no specific rule.)

getMinValuePosition

public final int getMinValuePosition()
Gets setting "minValuePosition".

Returns:
setting "minValuePosition".

setMinCommentPosition

public void setMinCommentPosition(int minPos)
Configures the writer to put as many spaces before the comment, so that it is placed at least at the given column.

Parameters:
minPos - (Use negative values for no specific rule.)

getMinCommentPosition

public final int getMinCommentPosition()
Gets setting "minCommentPosition".

Returns:
setting "minCommentPosition".

writeGroup

public void writeGroup(java.lang.String group)
                throws java.io.IOException
Writes a new Group to the file.

Parameters:
group -
Throws:
java.io.IOException

writeSetting

public void writeSetting(java.lang.String key,
                         java.lang.Object value,
                         java.lang.String comment)
                  throws java.io.IOException
Writes a new setting to the next line.

Parameters:
key -
value - if this is not a number, it is quoted in double-quotes and then written using the toString() method.
comment - null for no comment
Throws:
java.io.IOException

writeSetting

public final void writeSetting(java.lang.String key,
                               java.lang.Object value)
                        throws java.io.IOException
Writes a new setting to the next line.

Parameters:
key -
value - if this is not a number, it is quoted in double-quotes and then written using the toString() method.
Throws:
java.io.IOException

writeComment

public void writeComment(java.lang.String comment)
                  throws java.io.IOException
Writes a new (standalone) comment to the file.

Parameters:
comment -
Throws:
java.io.IOException

writeEmptyLine

public void writeEmptyLine()
                    throws java.io.IOException
Writes an empty line to the file.

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Flushes and closes the file.

Throws:
java.io.IOException