cz.cuni.amis.utils
Class IniFile.Section

Package class diagram package IniFile.Section
java.lang.Object
  extended by cz.cuni.amis.utils.IniFile.Section
Enclosing class:
IniFile

public static class IniFile.Section
extends Object

Class representing one section of the ini file.

Author:
Jimmy

Constructor Summary
IniFile.Section(IniFile.Section section)
          Copy-constructor.
IniFile.Section(String name)
          Creates a section of the given name.
 
Method Summary
 IniFile.Section add(IniFile.Section section)
          Adds all properties from 'section' into this one.
 void addComment(String comment)
          Adds comment to this section.
 void addComment(String keyValueCommented, String comment)
           
 IniFile.Section clear()
          Deletes all properties within this section.
 IniFile.Section clearComments()
          Deletes all comments within this section.
 boolean containsKey(String key)
          Whether the section contains property of the given key.
 String get(String key)
          Returns a value of the propety with 'key'.
 IniFile.SectionEntryKeyValue getEntry(String key)
          Returns full section entry for a 'key'.
 Set<String> getKeys()
          Returns all keys stored within the map.
 String getName()
          Returns name of the section.
 Set<String> keySet()
          Alias for getKeys().
 void output(PrintWriter writer)
          Writes this section into the writer.
 IniFile.Section put(String key, String value)
          Sets a property key=value into the section.
 IniFile.Section put(String key, String value, String comment)
          Sets a property key=value into the section with comment.
 IniFile.SectionEntryKeyValue remove(String key)
          Removes a property under the 'key' from this section.
 IniFile.Section set(String key, String value)
          Alias for put(String, String).
 IniFile.Section set(String key, String value, String comment)
          Alias for Section#put(String, Strin, String).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IniFile.Section

public IniFile.Section(String name)
Creates a section of the given name.

Name can't be null!

Parameters:
name -

IniFile.Section

public IniFile.Section(IniFile.Section section)
Copy-constructor.

Parameters:
section -
Method Detail

getName

public String getName()
Returns name of the section.

Returns:

put

public IniFile.Section put(String key,
                           String value)
Sets a property key=value into the section.

Parameters:
key -
value -
Returns:
this

put

public IniFile.Section put(String key,
                           String value,
                           String comment)
Sets a property key=value into the section with comment.

Parameters:
key -
value -
comment -
Returns:
this

get

public String get(String key)
Returns a value of the propety with 'key'.

Parameters:
key -
Returns:

getEntry

public IniFile.SectionEntryKeyValue getEntry(String key)
Returns full section entry for a 'key'.

Parameters:
key -
Returns:

containsKey

public boolean containsKey(String key)
Whether the section contains property of the given key.

Parameters:
key -
Returns:

getKeys

public Set<String> getKeys()
Returns all keys stored within the map.

Returns:

keySet

public Set<String> keySet()
Alias for getKeys().

Returns:

remove

public IniFile.SectionEntryKeyValue remove(String key)
Removes a property under the 'key' from this section. Time complexity O(n) due to section-entry-index consolidation.

Parameters:
key -
Returns:
removed IniFile.SectionEntryKeyValue

clear

public IniFile.Section clear()
Deletes all properties within this section.

Returns:

clearComments

public IniFile.Section clearComments()
Deletes all comments within this section.

Returns:

set

public IniFile.Section set(String key,
                           String value)
Alias for put(String, String).

Parameters:
key -
value -
Returns:
this

set

public IniFile.Section set(String key,
                           String value,
                           String comment)
Alias for Section#put(String, Strin, String).

Parameters:
key -
value -
comment -
Returns:
this

addComment

public void addComment(String comment)
Adds comment to this section.

Parameters:
comment -

addComment

public void addComment(String keyValueCommented,
                       String comment)

add

public IniFile.Section add(IniFile.Section section)
Adds all properties from 'section' into this one.

Parameters:
section -
Returns:

output

public void output(PrintWriter writer)
Writes this section into the writer.

Parameters:
writer -

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.